@Test public void testNext() { for (int i = 0; i < 100; i++) { System.out.println(randomSelector.next()); } }
@Nullable public T next() { if (size > 1) { T t = elements.get(ThreadLocalRandom.current().nextInt(size)); if (t == null) { t = elements.get(0); } return t; } else if (size == 1) { return elements.get(0); } else { return null; } }
RandomSelector implements Supplier<Mono<T>> { @Nullable public T next() { if (size > 1) { T t = elements.get(ThreadLocalRandom.current().nextInt(size)); if (t == null) { t = elements.get(0); } return t; } else if (size == 1) { return elements.get(0); } else { return null; } } }
RandomSelector implements Supplier<Mono<T>> { @Nullable public T next() { if (size > 1) { T t = elements.get(ThreadLocalRandom.current().nextInt(size)); if (t == null) { t = elements.get(0); } return t; } else if (size == 1) { return elements.get(0); } else { return null; } } RandomSelector(String name, List<T> elements); }
RandomSelector implements Supplier<Mono<T>> { @Nullable public T next() { if (size > 1) { T t = elements.get(ThreadLocalRandom.current().nextInt(size)); if (t == null) { t = elements.get(0); } return t; } else if (size == 1) { return elements.get(0); } else { return null; } } RandomSelector(String name, List<T> elements); @Nullable T next(); @Override Mono<T> get(); }
RandomSelector implements Supplier<Mono<T>> { @Nullable public T next() { if (size > 1) { T t = elements.get(ThreadLocalRandom.current().nextInt(size)); if (t == null) { t = elements.get(0); } return t; } else if (size == 1) { return elements.get(0); } else { return null; } } RandomSelector(String name, List<T> elements); @Nullable T next(); @Override Mono<T> get();  }