public final class CollectionUtils
extends java.lang.Object
CollectionUtils
class provides static utility methods for working with collections.
Andrei TatarnikovModifier and Type | Method and Description |
---|---|
static <T> java.util.List<T> |
appendToList(java.util.List<T> lhs,
java.util.List<T> rhs)
Appends all elements from the specified list to another list and
returns the updated list with the appended elements.
|
static <T> java.util.List<T> |
appendToList(java.util.List<T> lhs,
T elem)
Appends the specified element to the specified list and returns
the updated list with the appended element.
|
static <E> boolean |
areIntersectedSets(java.util.Set<E> lhs,
java.util.Set<E> rhs)
Checks whether two sets are intersected (have as non-empty intersection).
|
static <E> java.util.Set<E> |
complementSets(java.util.Set<E> lhs,
java.util.Set<E> rhs)
Returns a relative complement of two sets.
|
static <E> java.util.Set<E> |
intersectSets(java.util.Set<E> lhs,
java.util.Set<E> rhs)
Returns an intersection of two sets.
|
static <E> java.util.Set<E> |
uniteSets(java.util.Set<E> lhs,
java.util.Set<E> rhs)
Returns a union of two sets.
|
public static <E> java.util.Set<E> uniteSets(java.util.Set<E> lhs, java.util.Set<E> rhs)
E
- Set element type.lhs
- First set (left hand).rhs
- Second set (right hand).java.lang.IllegalArgumentException
- if any of the parameters is null
.public static <E> java.util.Set<E> intersectSets(java.util.Set<E> lhs, java.util.Set<E> rhs)
E
- Set element type.lhs
- First set (left hand).rhs
- Second set (right hand).java.lang.IllegalArgumentException
- if any of the parameters is null
.public static <E> boolean areIntersectedSets(java.util.Set<E> lhs, java.util.Set<E> rhs)
E
- Set element type.lhs
- First set (left hand).rhs
- Second set (right hand).true
if the sets are intersected, false
otherwise.java.lang.IllegalArgumentException
- if any of the parameters is null
.public static <E> java.util.Set<E> complementSets(java.util.Set<E> lhs, java.util.Set<E> rhs)
E
- Set element type.lhs
- First set (left hand).rhs
- Second set (right hand).java.lang.IllegalArgumentException
- if any of the parameters is null
.public static <T> java.util.List<T> appendToList(java.util.List<T> lhs, java.util.List<T> rhs)
T
- List element type.lhs
- List to which the elements will be appended.rhs
- List which contains elements to be appended.java.lang.IllegalArgumentException
- if any of the parameters is null
.public static <T> java.util.List<T> appendToList(java.util.List<T> lhs, T elem)
T
- List element type.lhs
- List to which the element will be appended.elem
- Element to be added.java.lang.IllegalArgumentException
- if the lhs
parameter is null
.