|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.cuni.amis.utils.collections.MyCollections
public class MyCollections
Nested Class Summary | |
---|---|
static interface |
MyCollections.IToString
|
Field Summary | |
---|---|
static MyCollections.IToString |
TO_STRING
|
Constructor Summary | |
---|---|
MyCollections()
|
Method Summary | ||
---|---|---|
static
|
asList(Collection<T> objects)
|
|
static
|
asList(Collection<T> objects,
IFilter filter)
|
|
static
|
asList(Collection<T> objects,
ObjectFilter filter)
|
|
static
|
asList(T[] objects)
|
|
static
|
asList(T[] objects,
IFilter filter)
|
|
static
|
asList(T[] objects,
ObjectFilter filter)
|
|
static
|
getFiltered(Collection<T> col,
IFilter filter)
Returns new list that contains only objects from 'col' that are IFilter.isAccepted(Object) . |
|
static
|
getFiltered(T[] array,
IFilter filter)
Returns new array that contains only objects from 'array' that are IFilter.isAccepted(Object) . |
|
static
|
getRandom(Collection<T> col)
Returns random element from the collection. |
|
static
|
getRandom(List<T> list)
Returns random element from the list. |
|
static
|
getRandom(T[] array)
Returns random element from the array. |
|
static
|
getRandomFiltered(Collection<T> col,
IFilter filter)
Returns random element from the collection that is IFilter.isAccepted(Object) by the 'filter'. |
|
static
|
getRandomFiltered(T[] array,
IFilter filter)
Returns random element from the array that is IFilter.isAccepted(Object) by the 'filter'. |
|
static
|
toCollection(T[] array,
Collection<T> col)
Moves data from 'array' to 'col'. |
|
static
|
toList(T[] objects,
List<T> list)
Adds 'objects' to 'list'. |
|
static
|
toList(T[] objects,
List<T> list,
IFilter filter)
Adds 'objects' that satisfies 'filter' to 'list'. |
|
static
|
toList(T[] objects,
List<T> list,
ObjectFilter filter)
Adds 'objects' that satisfies 'filter' to 'list'. |
|
static String |
toString(Object objToString,
String[] prefixes,
String[] postfixes,
String[] separators,
MyCollections.IToString toString)
|
|
static String |
toString(Object obj,
String prefix,
String postfix,
String separator)
|
|
static String |
toString(Object obj,
String prefix,
String postfix,
String separator,
MyCollections.IToString toString)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final MyCollections.IToString TO_STRING
Constructor Detail |
---|
public MyCollections()
Method Detail |
---|
public static <T> List<T> getFiltered(Collection<T> col, IFilter filter)
IFilter.isAccepted(Object)
.
T
- col
- filter
-
public static <T> T[] getFiltered(T[] array, IFilter filter)
IFilter.isAccepted(Object)
.
T
- col
- filter
-
public static <T> T getRandom(Collection<T> col)
WARNING: O(n) time complexity in the worst case scenario!
T
- col
-
public static <T> T getRandom(List<T> list)
O(1) time complexity.
T
- list
-
public static <T> T getRandom(T[] array)
T
- array
-
public static <T> T getRandomFiltered(Collection<T> col, IFilter filter)
IFilter.isAccepted(Object)
by the 'filter'.
WARNING: O(n) time complexity in the worst case scenario!
T
- col
- filter
- if null, performs getRandom(Collection)
public static <T> T getRandomFiltered(T[] array, IFilter filter)
IFilter.isAccepted(Object)
by the 'filter'.
T
- array
-
public static <T> void toList(T[] objects, List<T> list)
T
- objects
- list
- public static <T> void toList(T[] objects, List<T> list, ObjectFilter filter)
T
- objects
- list
- filter
- public static <T> void toList(T[] objects, List<T> list, IFilter filter)
T
- objects
- list
- filter
- public static <T> List<T> asList(T[] objects)
public static <T> List<T> asList(Collection<T> objects)
public static <T> List<T> asList(T[] objects, ObjectFilter filter)
public static <T> List<T> asList(Collection<T> objects, ObjectFilter filter)
public static <T> List<T> asList(T[] objects, IFilter filter)
public static <T> List<T> asList(Collection<T> objects, IFilter filter)
public static String toString(Object objToString, String[] prefixes, String[] postfixes, String[] separators, MyCollections.IToString toString)
public static String toString(Object obj, String prefix, String postfix, String separator)
public static String toString(Object obj, String prefix, String postfix, String separator, MyCollections.IToString toString)
public static <T> void toCollection(T[] array, Collection<T> col)
array
- col
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |