private Collection<InetSocketAddress> filterIfNecessary(Collection<InetSocketAddress> addrs,boolean filter){
  if (!filter)   return addrs;
  List<InetSocketAddress> res=new ArrayList<>(addrs.size());
  for (  InetSocketAddress addr : addrs)   if (!addr.isUnresolved())   res.add(addr);
  return res;
}

private Collection < InetSocketAddress > filterIfNecessary ( Collection < InetSocketAddress > addrs , boolean filter ) { if ( ! filter ) return addrs ; List < InetSocketAddress > res = new ArrayList < > ( addrs . size ( ) ) ; for ( InetSocketAddress addr : addrs ) if ( ! addr . isUnresolved ( ) ) res . add ( addr ) ; return res ; }
filters sockets with resolved addresses .
