Package de.xima.fc.utils
Class XCollectionUtils
- java.lang.Object
-
- de.xima.fc.utils.XCollectionUtils
-
public class XCollectionUtils extends Object
Utility class for operations on collections- Since:
- 7.0.0
- Author:
- XIMA Media GmbH
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TfirstItem(List<T> list)static <T> TlastItem(List<T> list)static <T> List<T>serializableList(Iterable<T> sequence)Takes anyCollectionorIterableand converts it to a serializable list that can be transferred via the API.
-
-
-
Method Detail
-
firstItem
public static <T> T firstItem(List<T> list)
- Type Parameters:
T- Type of the elements in the list.- Parameters:
list- List to process.- Returns:
- The first item in the list, or
nullif the list is null or empty, or the first item is null.
-
lastItem
public static <T> T lastItem(List<T> list)
- Type Parameters:
T- Type of the elements in the list.- Parameters:
list- List to process.- Returns:
- The last item in the list, or
nullif the list is null or empty, or the last item is null.
-
serializableList
public static <T> List<T> serializableList(Iterable<T> sequence)
Takes anyCollectionorIterableand converts it to a serializable list that can be transferred via the API.- Type Parameters:
T- Type of the list items.- Parameters:
sequence- A sequence of items to put into a list.- Returns:
- A serializable list with the given items.
-
-