public class CollectionUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
CollectionUtils.CollectionFilter<T>
Used with
filter(Collection, CollectionUtils.CollectionFilter)
to filter out unwanted entries in a Collection. |
static class |
CollectionUtils.SortEntitiesByDistance
|
static class |
CollectionUtils.SortTokensByDistance
|
| Modifier and Type | Method and Description |
|---|---|
static <T> List<T> |
combinedList(Collection<T>... toCombine)
Returns a combined
List from several Collections. |
static <T> Set<T> |
combinedSet(Collection<T>... toCombine)
Returns a combined
Set from several Collections. |
static <T> List<T> |
filter(Collection<T> toFilter,
CollectionUtils.CollectionFilter<T> filter)
Filters a
Collection and returns a List containing only
the entries that the filter accepted. |
static <T> List<T> |
filter(Collection<T> toFilter,
List<CollectionUtils.CollectionFilter<T>> filters)
Filters a
Collection and returns a List containing only
the entries that the filters accepted. |
static <T> String |
implode(Class<? extends Enum> toImplode)
|
static <T> String |
implode(Class<? extends Enum> toImplode,
String separator)
|
static String |
implode(Collection toImplode)
Creates a comma-separated
String from a Collection's
entries. |
static String |
implode(Collection toImplode,
String separator)
Combines and separates a
Collection of Strings. |
public static String implode(Collection toImplode, String separator)
Collection of Strings. Useful
for comma-separated lists.toImplode - A Collection whose contents should be combined
into one String.separator - The separator character to split toImplode with.String consisting of toImplode's values
separated with separator.public static String implode(Collection toImplode)
String from a Collection's
entries.toImplode - A Collection to be combined (using each entry's toString method).String consisting of toImplode's values
separated with commas.implode(java.util.Collection, java.lang.String)public static <T> String implode(Class<? extends Enum> toImplode)
toImplode - An Enum to be combined (using each entry's name() method).String consisting of toImplode's values separated with commas.implode(Class, String)@SafeVarargs public static <T> List<T> combinedList(Collection<T>... toCombine)
List from several Collections.toCombine - The Collection of elements to combine.ArrayList containing the combined contents of toCombine.@SafeVarargs public static <T> Set<T> combinedSet(Collection<T>... toCombine)
Set from several Collections.toCombine - The Collection of elements to combine.HashSet containing the combined contents of
toCombine. The capacity will be the total size of all
source Collections.public static <T> List<T> filter(Collection<T> toFilter, CollectionUtils.CollectionFilter<T> filter)
Collection and returns a List containing only
the entries that the filter accepted.toFilter - The Collection to filter.filter - A CollectionUtils.CollectionFilter that will be used to filter
toFilter.List containing only the entries of toFilter
that passed filter's accept() method.public static <T> List<T> filter(Collection<T> toFilter, List<CollectionUtils.CollectionFilter<T>> filters)
Collection and returns a List containing only
the entries that the filters accepted.toFilter - The Collection to filter.filters - A List of CollectionUtils.CollectionFilters that will be
used to filter toFilter.List containing only the entries of toFilter
that passed filters' accept() methods.filter(Collection, CollectionUtils.CollectionFilter)