cz.cuni.amis.utils.collections
Class MyCollections
java.lang.Object
cz.cuni.amis.utils.collections.MyCollections
public class MyCollections
- extends java.lang.Object
Method Summary |
static
|
asList(java.util.Collection<T> objects)
|
static
|
asList(java.util.Collection<T> objects,
ObjectFilter filter)
|
static
|
asList(T[] objects)
|
static
|
asList(T[] objects,
ObjectFilter filter)
|
static
|
getRandom(java.util.Collection<T> col)
Returns random element from the collection. |
static
|
getRandom(java.util.List<T> list)
Returns random element from the list. |
static
|
getRandom(T[] array)
Returns random element from the array. |
static
|
toList(T[] objects,
java.util.List<T> list)
|
static
|
toList(T[] objects,
java.util.List<T> list,
ObjectFilter filter)
|
static java.lang.String |
toString(java.lang.Object objToString,
java.lang.String[] prefixes,
java.lang.String[] postfixes,
java.lang.String[] separators,
MyCollections.IToString toString)
|
static java.lang.String |
toString(java.lang.Object obj,
java.lang.String prefix,
java.lang.String postfix,
java.lang.String separator)
|
static java.lang.String |
toString(java.lang.Object obj,
java.lang.String prefix,
java.lang.String postfix,
java.lang.String separator,
MyCollections.IToString toString)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TO_STRING
public static final MyCollections.IToString TO_STRING
MyCollections
public MyCollections()
getRandom
public static <T> T getRandom(java.util.Collection<T> col)
- Returns random element from the collection.
WARNING: O(n) time complexity in the worst case scenario!
- Type Parameters:
T
- - Parameters:
col
-
- Returns:
getRandom
public static <T> T getRandom(java.util.List<T> list)
- Returns random element from the list.
O(1) time complexity.
- Type Parameters:
T
- - Parameters:
list
-
- Returns:
getRandom
public static <T> T getRandom(T[] array)
- Returns random element from the array.
- Type Parameters:
T
- - Parameters:
array
-
- Returns:
toList
public static <T> void toList(T[] objects,
java.util.List<T> list)
toList
public static <T> void toList(T[] objects,
java.util.List<T> list,
ObjectFilter filter)
asList
public static <T> java.util.List<T> asList(T[] objects)
asList
public static <T> java.util.List<T> asList(java.util.Collection<T> objects)
asList
public static <T> java.util.List<T> asList(T[] objects,
ObjectFilter filter)
asList
public static <T> java.util.List<T> asList(java.util.Collection<T> objects,
ObjectFilter filter)
toString
public static java.lang.String toString(java.lang.Object objToString,
java.lang.String[] prefixes,
java.lang.String[] postfixes,
java.lang.String[] separators,
MyCollections.IToString toString)
toString
public static java.lang.String toString(java.lang.Object obj,
java.lang.String prefix,
java.lang.String postfix,
java.lang.String separator)
toString
public static java.lang.String toString(java.lang.Object obj,
java.lang.String prefix,
java.lang.String postfix,
java.lang.String separator,
MyCollections.IToString toString)