Add a toString method to NetworkInterface
import java.net.SocketException;
import java.util.Arrays;
import java.util.Iterator;
+import java.util.StringJoiner;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -133,4 +134,14 @@ public InetAddress getIp6Address() {
public String getName() {
return name;
}
+
+ @Override
+ public String toString() {
+ return new StringJoiner(", ", NetworkInterface.class.getSimpleName() + "[", "]")
+ .add("name='" + name + "'")
+ .add("networkInterface=" + networkInterface)
+ .add("inetAddresses=" + inetAddresses)
+ .add("isLoopback=" + isLoopback)
+ .toString();
+ }
}
