OneOrMore implements Iterable<T> { public boolean addAll(final Collection<? extends T> items) { boolean result = false; for (final T item : items) { if (add(item)) { result = true; } } return result; } OneOrMore();  OneOrMore(final boolean deduplicate);  OneOrMore(final boolean deduplicate, final T item); boolean add(final T item); boolean addAll(final Collection<? extends T> items); void removeAnyItem(); int size(); boolean isEmpty(); boolean contains(final Object o); @Override Iterator<T> iterator(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void shouldAddAllItemsWithDeduplicate() { final boolean deduplicate = true; final OneOrMore<Integer> collection = new OneOrMore<>(deduplicate); final Set<Integer> expectedItems = new HashSet<>(); IntStream.rangeClosed(1, 200).forEach(expectedItems::add); collection.addAll(expectedItems); collection.addAll(expectedItems); assertEquals(expectedItems, Sets.newHashSet(collection)); }