com.springsource.util.math
Class Sets

java.lang.Object
  extended by com.springsource.util.math.Sets

public class Sets
extends java.lang.Object

Defines common operations on Sets.

Concurrent Semantics
Threadsafe.

Since:
1.0
Author:
Rob Harrop

Constructor Summary
Sets()
           
 
Method Summary
static
<T> java.util.Set<T>
asSet(T... items)
          Creates a Set containing the supplied items.
static
<T> java.util.Set<T>
difference(java.util.Set<T> a, java.util.Set<T> b)
          Calculates the difference between a and b.
static
<T> java.util.Set<T>
intersection(java.util.Set<T> a, java.util.Set<T> b)
          Calculates the intersection between a and b.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sets

public Sets()
Method Detail

difference

public static <T> java.util.Set<T> difference(java.util.Set<T> a,
                                              java.util.Set<T> b)
Calculates the difference between a and b.

Type Parameters:
T - the type of the Set.
Parameters:
a - the lhs of the difference.
b - the rhs of the difference.
Returns:
the difference between a and b.

intersection

public static <T> java.util.Set<T> intersection(java.util.Set<T> a,
                                                java.util.Set<T> b)
Calculates the intersection between a and b.

Type Parameters:
T - the type of the Set.
Parameters:
a - the lhs of the intersection.
b - the rhs of the intersection.
Returns:
the intersection between a and b.

asSet

public static <T> java.util.Set<T> asSet(T... items)
Creates a Set containing the supplied items.

Type Parameters:
T - the type of the Set entries.
Parameters:
items - the Set contents.
Returns:
the resultant Set.