public interface UnmodSet<E> extends UnmodCollection<E>, Set<E>
Modifier and Type | Interface and Description |
---|---|
static class |
UnmodSet.AbstractUnmodSet<T>
Implements equals and hashCode() methods compatible with java.util.Set (which ignores order)
to make defining unmod sets easier, especially for implementing Map.keySet() and such.
|
UnmodIterable.AbstractUnmodIterable<T>
Modifier and Type | Method and Description |
---|---|
default boolean |
add(E e)
Deprecated.
|
default boolean |
addAll(Collection<? extends E> c)
Deprecated.
|
default void |
clear()
Deprecated.
|
boolean |
contains(Object o)
Returns true if the set contains the given item.
|
default boolean |
containsAll(Collection<?> items)
The default implementation of this method has O(this.size() + that.size()) or O(n) performance.
|
default boolean |
isEmpty()
This is a convenience method inherited from Collection that returns true if size() == 0 (if
this set contains no elements).
|
UnmodIterator<E> |
iterator()
Iterates over contents with no guarantees about their ordering.
|
default boolean |
remove(Object o)
Deprecated.
|
default boolean |
removeAll(Collection<?> c)
Deprecated.
|
default boolean |
removeIf(Predicate<? super E> filter)
Deprecated.
|
default boolean |
retainAll(Collection<?> c)
Deprecated.
|
default Object[] |
toArray()
This method goes against Josh Bloch's Item 25: "Prefer Lists to Arrays", but is provided for
backwards compatibility in some performance-critical situations.
|
default <T> T[] |
toArray(T[] as)
This method goes against Josh Bloch's Item 25: "Prefer Lists to Arrays", but is provided for
backwards compatibility in some performance-critical situations.
|
concat, drop, filter, flatMap, foldLeft, foldLeft, hash, hashCode, head, map, precat, take, takeWhile, toString
toImList, toImMap, toImSet, toImSortedMap, toImSortedSet, toMutableList, toMutableMap, toMutableSet, toMutableSortedMap, toMutableSortedSet
equals, hashCode, size, spliterator
parallelStream, stream
@Deprecated default boolean add(E e)
add
in interface Collection<E>
add
in interface Set<E>
add
in interface UnmodCollection<E>
@Deprecated default boolean addAll(Collection<? extends E> c)
addAll
in interface Collection<E>
addAll
in interface Set<E>
addAll
in interface UnmodCollection<E>
@Deprecated default void clear()
clear
in interface Collection<E>
clear
in interface Set<E>
clear
in interface UnmodCollection<E>
boolean contains(Object o)
default boolean containsAll(Collection<?> items)
containsAll
in interface Collection<E>
containsAll
in interface Set<E>
containsAll
in interface UnmodCollection<E>
default boolean isEmpty()
isEmpty
in interface Collection<E>
isEmpty
in interface Set<E>
isEmpty
in interface UnmodCollection<E>
UnmodIterator<E> iterator()
iterator
in interface Collection<E>
iterator
in interface Iterable<E>
iterator
in interface Set<E>
iterator
in interface UnmodCollection<E>
iterator
in interface UnmodIterable<E>
@Deprecated default boolean remove(Object o)
remove
in interface Collection<E>
remove
in interface Set<E>
remove
in interface UnmodCollection<E>
@Deprecated default boolean removeAll(Collection<?> c)
removeAll
in interface Collection<E>
removeAll
in interface Set<E>
removeAll
in interface UnmodCollection<E>
@Deprecated default boolean retainAll(Collection<?> c)
retainAll
in interface Collection<E>
retainAll
in interface Set<E>
retainAll
in interface UnmodCollection<E>
default Object[] toArray()
toArray
in interface Collection<E>
toArray
in interface Set<E>
toArray
in interface UnmodCollection<E>
default <T> T[] toArray(T[] as)
MyThing[] things = col.toArray(new MyThing[coll.size()]);
Calling this method any other way causes unnecessary work to be done - an extra memory
allocation and potential garbage collection if the passed array is too small, extra effort to
fill the end of the array with nulls if it is too large.
This method goes against Josh Bloch's Item 25: "Prefer Lists to Arrays", but is provided for backwards
compatibility in some performance-critical situations. If you need to create an array (you almost always do)
then the best way to use this method is:
MyThing[] things = col.toArray(new MyThing[coll.size()]);
Calling this method any other way causes unnecessary work to be done - an extra memory allocation and potential
garbage collection if the passed array is too small, extra effort to fill the end of the array with nulls if it
is too large.
toArray
in interface Collection<E>
toArray
in interface Set<E>
toArray
in interface UnmodCollection<E>
@Deprecated default boolean removeIf(Predicate<? super E> filter)
removeIf
in interface Collection<E>
removeIf
in interface UnmodCollection<E>
Copyright © 2016. All rights reserved.