use of com.badlogic.gdx.utils.ObjectSet in project Mindustry by Anuken.
the class KryoClient method discover.
@Override
public void discover(Consumer<Array<Host>> callback) {
runAsync(() -> {
addresses.clear();
List<InetAddress> list = client.discoverHosts(port, 3000);
ObjectSet<String> hostnames = new ObjectSet<>();
Array<Host> result = new Array<>();
for (InetAddress a : list) {
if (!hostnames.contains(a.getHostName())) {
Host address = addresses.get(a);
if (address != null)
result.add(address);
}
hostnames.add(a.getHostName());
}
Gdx.app.postRunnable(() -> callback.accept(result));
});
}
Aggregations