Class ListUtils
java.lang.Object
org.aksw.commons.util.list.ListUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TgetOrDefault(List<T> list, int i, T dflt) static <T> TReturn the item at index or null if it does not exist.static <T> TlastOrDefault(List<T> list, T defaultValue) static <T> TlastOrNull(List<T> list) Returns the last item of the list or null if it does not existstatic <I,O> List <O>
-
Constructor Details
-
ListUtils
public ListUtils()
-
-
Method Details
-
getOrNull
Return the item at index or null if it does not exist. Checks the size of the list before accessing the item (hence, the complexity of size() is ideally O(1)) Argument must not be negative- Parameters:
list-i-- Returns:
-
getOrDefault
-
lastOrNull
Returns the last item of the list or null if it does not exist -
lastOrDefault
-
map
-