Package com.usatiuk.utils
Class ListUtils
java.lang.Object
com.usatiuk.utils.ListUtils
Utility class for list operations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,
T_V> List <T_V> Maps a list using a provided function.static <T> List
<T> Prepends an item to a list.static <T,
T_V> List <T_V> prependAndMap
(T_V item, List<T> suffix, Function<T, T_V> suffixFn) Prepends an item to a list and maps the rest of the list using a provided function.
-
Constructor Details
-
ListUtils
public ListUtils()
-
-
Method Details
-
prependAndMap
Prepends an item to a list and maps the rest of the list using a provided function.- Type Parameters:
T
- The type of the items in the list.T_V
- The type of the mapped items.- Parameters:
item
- The item to prepend.suffix
- The list to append to.suffixFn
- The function to map the suffix items.- Returns:
- A new list with the prepended item and mapped suffix items.
-
prepend
Prepends an item to a list.- Type Parameters:
T
- The type of the items in the list.- Parameters:
item
- The item to prepend.suffix
- The list to append to.- Returns:
- A new list with the prepended item and the original suffix items.
-
map
Maps a list using a provided function.- Type Parameters:
T
- The type of the items in the list.T_V
- The type of the mapped items.- Parameters:
suffix
- The list to map.suffixFn
- The function to map the items.- Returns:
- A new list with the mapped items.
-