public final class SetOperations extends Object
Modifier | Constructor and Description |
---|---|
private |
SetOperations()
Hidden utility constructor.
|
Modifier and Type | Method and Description |
---|---|
static <T> Set<T> |
difference(Set<T> setA,
Set<T> setB)
Get the set difference A\B of the sets A and B.
|
static <T> Set<T> |
intersection(Collection<T> setA,
Collection<T> setB)
Get the intersection of two sets.
|
static <T> boolean |
isSubset(Set<T> setA,
Set<T> setB)
Is setA a subset of setB.
|
static <T> boolean |
isSuperset(Set<T> setA,
Set<T> setB)
Is setA a superset of setB.
|
static <T> Set<T> |
symDifference(Set<T> setA,
Set<T> setB)
Get the elements of sets A,B that are not in their intersection.
|
static <T> Set<T> |
union(Set<T> setA,
Set<T> setB)
Get the union of two sets.
|
public static <T> Set<T> union(Set<T> setA, Set<T> setB)
T
- The genetic type of the sets used.setA
- one of two sets for the unionsetB
- second of two sets for the unionpublic static <T> Set<T> intersection(Collection<T> setA, Collection<T> setB)
T
- The generic type of the sets used.setA
- one of two sets for the intersectionsetB
- second of two sets for the intersectionpublic static <T> Set<T> difference(Set<T> setA, Set<T> setB)
T
- The genetic type of the sets used.setA
- the set whose elements will be retained.setB
- the set whose elements will be subtracted from A.public static <T> Set<T> symDifference(Set<T> setA, Set<T> setB)
T
- The generic type of the sets used.setA
- one of two sets for the intersectionsetB
- second of two sets for the intersectionpublic static <T> boolean isSubset(Set<T> setA, Set<T> setB)
T
- The generic type of the sets used.setA
- the (potential) subset.setB
- the original (superset).Copyright © 2015 University of Glasgow. All rights reserved.