boolean pingOK = false;
try {
pingOK = InetAddress.getByName(ip).isReachable(200);
} catch(IOException e) {
pingOK = false;
}
Can these code cut down from 6 lines to 1 line?
Such as:
boolean pingOK = withNoException(InetAddress.getByName(ip).isReachable(200));
Maybe above Java 8 some functional exception trick?
Or under Java 7 is there some way to do this?