|
LazyLib | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectCollectionUtils
public class CollectionUtils
Contains methods for working with Collections.
Nested Class Summary | |
---|---|
static interface |
CollectionUtils.CollectionFilter<T>
Used with filter(Collection, CollectionUtils.CollectionFilter)
to filter out unwanted entries in a Collection . |
static class |
CollectionUtils.SortEntitiesByDistance
A Comparator that sorts CombatEntityAPI s by distance from
the Vector2f passed into the constructor. |
static class |
CollectionUtils.SortObjectivesByDistance
Deprecated. Use CollectionUtils.SortEntitiesByDistance instead. |
static class |
CollectionUtils.SortTokensByDistance
A Comparator that sorts SectorEntityToken s by distance
the Vector2f passed into the constructor. |
Method Summary | ||
---|---|---|
static
|
filter(Collection<T> toFilter,
CollectionUtils.CollectionFilter<T> filter)
Filters a Collection and returns a List containing only
the entries that the filter accepted. |
|
static
|
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. |
|
static
|
weightedRandom(Map<T,Float> pickFrom)
Deprecated. Use WeightedRandomPicker instead. |
|
static
|
weightedRandom(Map<T,Float> pickFrom,
int numToPick)
Deprecated. Use WeightedRandomPicker instead (call pick()
multiple times). |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
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> 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()
method.
filter(Collection, CollectionUtils.CollectionFilter)
@Deprecated public static <T> List<T> weightedRandom(Map<T,Float> pickFrom, int numToPick)
WeightedRandomPicker
instead (call pick()
multiple times).
@Deprecated public static <T> T weightedRandom(Map<T,Float> pickFrom)
WeightedRandomPicker
instead.
|
LazyLib | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |