@Test public void emptyList() { ServerEntry entry = new ServerEntry(Collections.emptyList(), 0L); Assert.assertTrue(entry.next(1).isEmpty()); }
List<Server> next(int n) { if (servers.isEmpty()) { return Collections.emptyList(); } final List<Server> out = new ArrayList<>(n); final int size = servers.size(); final int start = Integer.remainderUnsigned(nextPos.getAndIncrement(), size); for (int i = 0, j = start; i < n; ++i, ++j) { out.add(servers.get(j % size)); } return out; }
ServerEntry { List<Server> next(int n) { if (servers.isEmpty()) { return Collections.emptyList(); } final List<Server> out = new ArrayList<>(n); final int size = servers.size(); final int start = Integer.remainderUnsigned(nextPos.getAndIncrement(), size); for (int i = 0, j = start; i < n; ++i, ++j) { out.add(servers.get(j % size)); } return out; } }
ServerEntry { List<Server> next(int n) { if (servers.isEmpty()) { return Collections.emptyList(); } final List<Server> out = new ArrayList<>(n); final int size = servers.size(); final int start = Integer.remainderUnsigned(nextPos.getAndIncrement(), size); for (int i = 0, j = start; i < n; ++i, ++j) { out.add(servers.get(j % size)); } return out; } ServerEntry(List<Server> servers, long ctime); }
ServerEntry { List<Server> next(int n) { if (servers.isEmpty()) { return Collections.emptyList(); } final List<Server> out = new ArrayList<>(n); final int size = servers.size(); final int start = Integer.remainderUnsigned(nextPos.getAndIncrement(), size); for (int i = 0, j = start; i < n; ++i, ++j) { out.add(servers.get(j % size)); } return out; } ServerEntry(List<Server> servers, long ctime);  }
ServerEntry { List<Server> next(int n) { if (servers.isEmpty()) { return Collections.emptyList(); } final List<Server> out = new ArrayList<>(n); final int size = servers.size(); final int start = Integer.remainderUnsigned(nextPos.getAndIncrement(), size); for (int i = 0, j = start; i < n; ++i, ++j) { out.add(servers.get(j % size)); } return out; } ServerEntry(List<Server> servers, long ctime);   }