public class CollectionUtil
extends java.lang.Object
| Constructor and Description |
|---|
CollectionUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <U> java.util.ArrayList<U> |
toList(java.util.Enumeration<U> enumeration)
Converts an enumeration to an array list
|
static <U> java.util.List<U> |
toList(U... objects)
Creates a list from objects.
|
static <U> java.util.List<U> |
toList(U object)
Creates a list from a single object.
|
static <U> java.util.Set<U> |
toSet(U... objects)
Creates a set from objects.
|
static <U> java.util.Set<U> |
toSet(U object)
Creates a set from a single object.
|
static <U> java.util.List<U> |
toUnmodifiableList(U... objects)
Creates an unmodifiable list from objects.
|
static <U> java.util.List<U> |
toUnmodifiableList(U object)
Creates an unmodifiable list from a single object.
|
static <U> java.util.Set<U> |
toUnmodifiableSet(U... objects)
Creates an unmodifiable set from objects.
|
static <U> java.util.Set<U> |
toUnmodifiableSet(U object)
Creates an unmodifiable set from a single object.
|
public static <U> java.util.List<U> toList(U object)
U - The object typeobject - The object the list will hold. If the object is null an
empty list will be returnedpublic static <U> java.util.List<U> toUnmodifiableList(U object)
U - The object typeobject - The object the list will hold. If the object is null an
empty list will be returned.@SafeVarargs public static <U> java.util.List<U> toList(U... objects)
U - The object typeobjects - The objects the list will hold. If no objects are passed an
empty list will be returned.public static <U> java.util.ArrayList<U> toList(java.util.Enumeration<U> enumeration)
U - The object typeenumeration - enumeration providing elements for the returned
array list@SafeVarargs public static <U> java.util.List<U> toUnmodifiableList(U... objects)
U - The object typeobjects - The objects the list will hold. If no objects are passed an
empty list will be returned.public static <U> java.util.Set<U> toSet(U object)
U - The object typeobject - The object the set will hold. If the object is null an
empty set will be returned.public static <U> java.util.Set<U> toUnmodifiableSet(U object)
U - The object typeobject - The object the set will hold. If the object is null an
empty set will be returned.@SafeVarargs public static <U> java.util.Set<U> toSet(U... objects)
U - The object typeobjects - The objects the set will hold. If no objects are passed an
empty set will be returned.@SafeVarargs public static <U> java.util.Set<U> toUnmodifiableSet(U... objects)
U - The object typeobjects - The objects the set will hold. If no objects are passed an
empty set will be returned.