Package org.apache.storm.daemon.utils
Class ListFunctionalSupport
java.lang.Object
org.apache.storm.daemon.utils.ListFunctionalSupport
Implements missing sequence functions in Java compared to Clojure.
 To make thing simpler, it only supports List type.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> List<T>Drop the first N elements and create a new list.static <T> TGet the first element in list.static <T> Tget the last element in list.static <T> List<T>Drop the only first element and create a new list.static <T> List<T>Get the last N elements as a new list.
- 
Constructor Details- 
ListFunctionalSupportpublic ListFunctionalSupport()
 
- 
- 
Method Details- 
firstGet the first element in list.- Parameters:
- list- list to get
- Returns:
- the first element. null if list is null or empty.
 
- 
lastget the last element in list.- Parameters:
- list- list to get
- Returns:
- the last element. null if list is null or empty.
 
- 
takeLastGet the last N elements as a new list.- Parameters:
- list- list to get
- count- element count to get
- Returns:
- the first element. null if list is null. elements in a new list may be less than count if there're not enough elements in the list.
 
- 
dropDrop the first N elements and create a new list.- Parameters:
- list- the list
- count- element count to drop
- Returns:
- newly created sublist that drops the first N elements from origin list. null if list is null.
 
- 
restDrop the only first element and create a new list. equivalent to drop(list, 1).- Parameters:
- list- the list
- Returns:
- newly created sublist that drops the first element from origin list. null if list is null.
 
 
-