Package org.glassfish.admin.amx.util
Class SetUtil
- java.lang.Object
-
- org.glassfish.admin.amx.util.SetUtil
-
public final class SetUtil extends Object
Utilities for working with sets using JDK 1.5 generics.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> voidaddArray(Set<T> set, T[] array)static <T> HashSet<T>copySet(Set<? extends T> s1)Create a new Set containing all members of another.static StringfindIgnoreCase(Set<String> candidates, String target)static <T> TgetSingleton(Set<T> s)static <T> Set<T>intersectSets(Set<T> set1, Set<T> set2)Return a new Set of all items in both set1 and set2.static <T> Set<T>newNotCommonSet(Set<T> set1, Set<T> set2)Return a new Set of all items not common to both sets.static <T> Set<T>newSet()static <T> Set<T>newSet(Collection<T> c)static <T,TT extends T>
Set<T>newSet(Set<T> s1, Set<TT> s2)static <T> Set<T>newSet(T item)Create a new Set with one member.static <T> Set<T>newSet(T[] objects)Create a new Set containing all array elements.static <T> Set<T>newSet(T[] objects, int startIndex, int numItems)Create a new Set containing all array elements.static <T> Set<? extends T>newSet(T m1, T m2)static <T> Set<T>newSet(T m1, T m2, T m3, T m4)static <T> Set<T>newSingletonSet(T m1)Create a new Set with one member.static Set<String>newStringSet(String... args)static <T> Set<T>newTypedSet(T... args)static <T> Set<T>newUnmodifiableSet(T... args)static Set<String>newUnmodifiableStringSet(String... args)static <T> Set<T>removeSet(Set<T> set1, Set<T> set2)Return a new Set of all items in set1 not in set2.static String[]toSortedStringArray(Set<?> s)static String[]toStringArray(Set<?> s)Convert a Set to a String[]
-
-
-
Method Detail
-
getSingleton
public static <T> T getSingleton(Set<T> s)
-
addArray
public static <T> void addArray(Set<T> set, T[] array)
-
newSet
public static <T> Set<T> newSet()
-
newSet
public static <T> Set<T> newSet(Collection<T> c)
-
newSet
public static <T> Set<T> newSet(T item)
Create a new Set with one member.
-
copySet
public static <T> HashSet<T> copySet(Set<? extends T> s1)
Create a new Set containing all members of another. The returned Set is always a HashSet.
-
newSet
public static <T> Set<? extends T> newSet(T m1, T m2)
-
newSet
public static <T> Set<T> newSet(T m1, T m2, T m3, T m4)
-
newSet
public static <T> Set<T> newSet(T[] objects)
Create a new Set containing all array elements.
-
newSet
public static <T> Set<T> newSet(T[] objects, int startIndex, int numItems)
Create a new Set containing all array elements.
-
newUnmodifiableSet
public static <T> Set<T> newUnmodifiableSet(T... args)
-
newTypedSet
public static <T> Set<T> newTypedSet(T... args)
-
newSingletonSet
public static <T> Set<T> newSingletonSet(T m1)
Create a new Set with one member. Additional items may be added.
-
intersectSets
public static <T> Set<T> intersectSets(Set<T> set1, Set<T> set2)
Return a new Set of all items in both set1 and set2.
-
removeSet
public static <T> Set<T> removeSet(Set<T> set1, Set<T> set2)
Return a new Set of all items in set1 not in set2.
-
newNotCommonSet
public static <T> Set<T> newNotCommonSet(Set<T> set1, Set<T> set2)
Return a new Set of all items not common to both sets.
-
-