1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| public interface Collection<E> extends Iterable<E>{ int size();
boolean isEmpty();
boolean contains(Object o);
@NotNull Iterable<E> iterator();
@NotNull @Flow(sourceContainer = true ,targetContainer = true) Object[] toArray();
@NotNull @Flow(sourceContainer = true ,targetContainer = true) <T> T[] toArray(@NotNull T[] a);
@Contract(mutates="this") boolean add(E e);
@Contract(mutates="this") boolean remove(Object o);
boolean containsAll(@NotNull Collection<?> c);
@Contract(mutates="this") boolean addAll(@NotNull @Flow(sourceContainer = true, targetContainer = true) Collection<? extends E> c);
@Contract(mutates="this") boolean removeAll(@NotNull Collection<?> c);
@Contract(mutates="this") default boolean removeIf(Predicate<? super E> filter){ Object.requireNonNull(filter); boolean removed = false; final Iterator<E> each = iterator(); while(each.hasNext()){ if(filter.test(each.next())){ each.remove(); removed = true; } }
return removed; }
@Contract(mutates="this") boolean retainAll(@NotNull Collection<?> c);
@Contract(mutates="this") void clear();
boolean equals(Object o);
int hashCode();
@Contract(pure=true) @Override default Spliterator<E> spliterator(){ return Spliterators.spliterator(this,0);}
@Contract(pure=true) default Stream<E> stream() { return StreamSupport.stream(spliterator(),false);}
@Contract(pure=true) default Stream<E> parallelStream(){ return StreamSupport.stream(spliterator(),true);} }
|