public class CollectionsUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static List<Object> |
asList(Object object)
Converts the given object into a
List. |
static Map<String,String> |
asMap(String... entries)
Accepts one or more entries as strings in the format recognized by
parseMapEntry(String) and populates a Map of Strings
with these associations. |
static Map<Object,Object> |
createMapOfParsedObjects(Iterable<?> iterable)
|
static List<Object> |
distincList(List<Object> list)
Returns a list consisting of the distinct elements (according to Object.equals(Object))
of a given list.
|
static boolean |
isEmpty(Collection<?> collection) |
static Object |
max(Iterable<?> iterable)
Returns the maximum element inside the given Iterable
|
static Object |
min(Iterable<?> iterable)
Returns the minimum element inside the given Iterable
|
static Stack<Object> |
newParametersStack(Object... parameters)
Produces a Stack to be processed by JEP functions.
|
static Map.Entry<String,String> |
parseMapEntry(String entry)
Parses a string into a
Map.Entry. |
public static boolean isEmpty(Collection<?> collection)
collection - the collection to be evaluatedtrue if the given collection is either null or empty; otherwise, false.public static List<Object> asList(Object object)
List.
If the source object is either an array of Objects (primitive types not
supported) or a JSONArray, it will return a List backed by the specified array.
If a non-null Object is received (not a List or JSONArray), a singleton
list will be returned (containing only the specified object). If a null or empty object
is received, then an empty list will be returned. If the input is already a
List, the same object will be returned.
object - the source object to be parsed into a ListList objectpublic static Map<String,String> asMap(String... entries)
parseMapEntry(String) and populates a Map of Strings
with these associations.entries - one or more strings containing, each one, a map entry parseable by
parseMapEntry(String)Map containing associations for the given entriespublic static Map.Entry<String,String> parseMapEntry(String entry)
Map.Entry.entry - a string containing a key, a separator, and a value. A separator can be
either an equal sign (=) or colon (:). For example:
"key1=value1" or "key2:value2"Map.Entry of Strings for the given entry stringpublic static Map<Object,Object> createMapOfParsedObjects(Iterable<?> iterable)
Iterable into a Map where each key is an element of
the given Iterable, parsed either as Double or Date, and the
associated value is the original element without conversion.iterable - the Iterable to be convertedpublic static Object max(Iterable<?> iterable)
iterable - the Iterable whose maximum element is to be evaluatedpublic static Object min(Iterable<?> iterable)
iterable - the Iterable whose minimum element is to be evaluatedpublic static List<Object> distincList(List<Object> list)
list - the list to be processedCopyright © 2021. All rights reserved.