I need a map in which I store ID (key) and hostname:port (value). What type of object should I use to store the value?
I tried something like this:
map.put(id, new URI("localhost:2222"));
But after I’d executed
entry.getValue().getHost()
and
entry.getValue().getPort()
I got: null and -1.
I need only hostname and port, nothing more.
You could use an InetSocketAddress.