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 Collection s. |
static <T> Set<T> |
combinedSet(Collection<T>... toCombine)
Returns a combined
Set from several Collection s. |
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 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 String s. |
public static String implode(Collection toImplode, String separator)
Collection
of String
s. 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> List<T> combinedList(Collection<T>... toCombine)
List
from several Collection
s.toCombine
- The Collection
of elements to combine.ArrayList
containing the combined contents of
toCombine
.public static <T> Set<T> combinedSet(Collection<T>... toCombine)
Set
from several Collection
s.toCombine
- The Collection
of elements to combine.HashSet
containing the combined contents of
toCombine
. The capacity will be the total size of all
source Collection
s.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.CollectionFilter
s that will be
used to filter toFilter
.
List
containing only the entries of toFilter
that passed filters
' accept()
methods.
filter(Collection, CollectionUtils.CollectionFilter)