E - the type of object stored in the setpublic abstract class SmallSet<E> extends AbstractSet<E>
SmallSet class implements immutable instances the
Set interface tailored for sets with a small number of
members. The sets created are included as member variables for
very small sets and backed by arrays for larger sets. Although
SmallSet does not support the Set.add(Object)
method, it provides its own union(SmallSet) operation,
which produces a new small set that is the result of unioning the
set to which it is applied to the small set in the argument. There
are no public constructors. Instaces are created using a family of
create factory method in order to construct an
appropriate representation based on the size of set being created.| Modifier and Type | Method and Description |
|---|---|
static <F> SmallSet<F> |
create()
Return an empty small set.
|
static <F> SmallSet<F> |
create(F member)
Return a singleton empty set containing the specified member.
|
static <F> SmallSet<F> |
create(F[] members)
Return a set consisting of members drawn from the specified
array of members.
|
static <F> SmallSet<F> |
create(F member1,
F member2)
Return a set containing the two specified members.
|
static <F> SmallSet<F> |
create(F member,
Set<? extends F> set)
Return a small set containing the member and set of
members specified in the arguments.
|
static <F> SmallSet<F> |
create(Set<? extends F> members)
Return a small set containing the members specified in the set
argument.
|
static <F> SmallSet<F> |
create(Set<? extends F> set1,
Set<? extends F> set2)
Return a small set containing all of the members of
both specified sets.
|
abstract SmallSet<E> |
union(SmallSet<? extends E> that)
Returns the union of this set with the specified set,
without modifying either this set or the specified set.
|
equals, hashCode, removeAlladd, addAll, clear, contains, containsAll, isEmpty, iterator, remove, retainAll, size, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitadd, addAll, clear, contains, containsAll, isEmpty, iterator, remove, retainAll, size, spliterator, toArray, toArrayparallelStream, removeIf, streampublic abstract SmallSet<E> union(SmallSet<? extends E> that)
that - Small set of elements to union with this set.public static <F> SmallSet<F> create()
F - the type of object stored in the setpublic static <F> SmallSet<F> create(F member)
F - the type of object stored in the setmember - Single member of the returned set.public static <F> SmallSet<F> create(F member1, F member2)
F - the type of object stored in the setmember1 - First member of set.member2 - Second member of set.public static <F> SmallSet<F> create(F[] members)
create(), create(Object), and
create(Object,Object), respectively.F - the type of object stored in the setmembers - Array of members for the resulting set.public static <F> SmallSet<F> create(Set<? extends F> members)
F - the type of object stored in the setmembers - Set of members of the resulting set.public static <F> SmallSet<F> create(F member, Set<? extends F> set)
F - the type of object stored in the setmember - Member to add to result set.set - Set of members to add to the result set.public static <F> SmallSet<F> create(Set<? extends F> set1, Set<? extends F> set2)
F - the type of object stored in the setset1 - First set of members of result set.set2 - Second set of members of result set.Copyright © 2019 Alias-i, Inc.. All rights reserved.