|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet<E>
com.aliasi.util.SmallSet<E>
E - the type of object stored in the setpublic abstract class SmallSet<E>
The 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.
| Method Summary | ||
|---|---|---|
static
|
create()
Return an empty small set. |
|
static
|
create(F member)
Return a singleton empty set containing the specified member. |
|
static
|
create(F[] members)
Return a set consisting of members drawn from the specified array of members. |
|
static
|
create(F member1,
F member2)
Return a set containing the two specified members. |
|
static
|
create(F member,
Set<? extends F> set)
Return a small set containing the member and set of members specified in the arguments. |
|
static
|
create(Set<? extends F> members)
Return a small set containing the members specified in the set argument. |
|
static
|
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. |
|
| Methods inherited from class java.util.AbstractSet |
|---|
equals, hashCode, removeAll |
| Methods inherited from class java.util.AbstractCollection |
|---|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, retainAll, size, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, retainAll, size, toArray, toArray |
| Method Detail |
|---|
public 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 set
public 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.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||