Java EE 5 SDK

com.sun.appserv.management.util.misc
Class GSetUtil

java.lang.Object
  extended by com.sun.appserv.management.util.misc.GSetUtil

public final class GSetUtil
extends Object

Utilities for working with sets using JDK 1.5 generics.


Method Summary
static
<T> void
addArray(Set<T> set, T[] array)
           
static
<T> HashSet<T>
copySet(Set<? extends T> s1)
          Create a new Set containing all members of another.
static
<T> T
getSingleton(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(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(Object... args)
           
static Set<String> newStringSet(String... 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[]
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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(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,TT extends T> Set<T> newSet(Set<T> s1,
                                             Set<TT> s2)

newSet

public static <T> Set<T> newSet(T[] objects,
                                int startIndex,
                                int numItems)
Create a new Set containing all array elements.


toStringArray

public static String[] toStringArray(Set<?> s)
Convert a Set to a String[]


toSortedStringArray

public static String[] toSortedStringArray(Set<?> s)

newStringSet

public static Set<String> newStringSet(String... args)

newUnmodifiableSet

public static <T> Set<T> newUnmodifiableSet(T... args)

newUnmodifiableStringSet

public static Set<String> newUnmodifiableStringSet(String... args)

newStringSet

public static Set<String> newStringSet(Object... 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.


Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.