|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mindswap.pellet.utils.SetUtils
public class SetUtils
Utility functions for {#link java.util.Set Set}s.
Field Summary | |
---|---|
static java.util.Set<?> |
EMPTY_SET
|
Constructor Summary | |
---|---|
SetUtils()
|
Method Summary | ||
---|---|---|
static
|
add(T o,
java.util.Set<T> set)
Adds the given object to the set but saves memory space by allocating only the required amount for small sets. |
|
static
|
binary(T o1,
T o2)
|
|
static
|
create(java.util.Collection<T> coll)
Creates a set containing all the elements in the collection |
|
static
|
create(T... elems)
Creates a list containing all the elements in the array |
|
static
|
difference(java.util.Collection<T> c1,
java.util.Collection<? extends java.lang.Object> c2)
Returns the difference of two sets. |
|
static
|
emptySet()
|
|
static
|
equals(java.util.Set<T> s1,
java.util.Set<T> s2)
Checks if one set is equal of another one |
|
static
|
intersection(java.util.Collection<? extends java.util.Collection<? extends T>> coll)
Returns the intersection of all the collections given in a collection. |
|
static
|
intersection(java.util.Collection<? extends T> c1,
java.util.Collection<? extends T> c2)
Returns the intersection of two collections |
|
static boolean |
intersects(java.util.Collection<?> c1,
java.util.Collection<?> c2)
Checks if two collections have any elements in common |
|
static
|
remove(java.lang.Object o,
java.util.Set<T> set)
|
|
static
|
singleton(T o)
|
|
static boolean |
subset(java.util.Set<?> sub,
java.util.Set<?> sup)
Checks if one set is subset of another one |
|
static
|
union(java.util.Collection<? extends java.util.Collection<? extends T>> coll)
Returns the union of all the sets given in a collection. |
|
static
|
union(java.util.Collection<? extends T> c1,
java.util.Collection<? extends T> c2)
Returns the union of two collections |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.Set<?> EMPTY_SET
Constructor Detail |
---|
public SetUtils()
Method Detail |
---|
public static <T> java.util.Set<T> add(T o, java.util.Set<T> set)
o
- set
-
public static final <T> java.util.Set<T> emptySet()
public static <T> java.util.Set<T> remove(java.lang.Object o, java.util.Set<T> set)
public static final <T> java.util.Set<T> singleton(T o)
public static final <T> java.util.Set<T> binary(T o1, T o2)
public static <T> java.util.Set<T> union(java.util.Collection<? extends java.util.Collection<? extends T>> coll)
coll
- A Collection of setspublic static <T> java.util.Set<T> union(java.util.Collection<? extends T> c1, java.util.Collection<? extends T> c2)
coll
- A Collection of setspublic static <T> java.util.Set<T> intersection(java.util.Collection<? extends java.util.Collection<? extends T>> coll)
coll
- A Collection of setspublic static <T> java.util.Set<T> intersection(java.util.Collection<? extends T> c1, java.util.Collection<? extends T> c2)
coll
- A Collection of setspublic static boolean intersects(java.util.Collection<?> c1, java.util.Collection<?> c2)
public static boolean subset(java.util.Set<?> sub, java.util.Set<?> sup)
sub
- sup
-
public static <T> boolean equals(java.util.Set<T> s1, java.util.Set<T> s2)
sub
- sup
-
public static <T> java.util.Set<T> difference(java.util.Collection<T> c1, java.util.Collection<? extends java.lang.Object> c2)
coll
- A Collection of setspublic static <T> java.util.Set<T> create(T... elems)
elements
-
public static <T> java.util.Set<T> create(java.util.Collection<T> coll)
elements
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |