Package de.xima.fc.utils
Class IterableUtils
- java.lang.Object
 - 
- de.xima.fc.utils.IterableUtils
 
 
- 
public final class IterableUtils extends Object
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceIterableUtils.Indexed<T>Represents an item with an index. 
- 
Constructor Summary
Constructors Constructor Description IterableUtils() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TfirstOrNull(Iterable<T> iterable)Similar to thefirstmethod from Apache Commons, but returnsnullinstead of throwing if the iterable is empty.static <T> Iterable<IterableUtils.Indexed<T>>withIndex(Iterable<T> iterable) 
 - 
 
- 
- 
Method Detail
- 
withIndex
public static <T> Iterable<IterableUtils.Indexed<T>> withIndex(Iterable<T> iterable)
 
- 
firstOrNull
public static <T> T firstOrNull(Iterable<T> iterable)
Similar to thefirstmethod from Apache Commons, but returnsnullinstead of throwing if the iterable is empty.- Type Parameters:
 T- Type of the items in the iterable.- Parameters:
 iterable- Iterable to process.- Returns:
 - The first item in the iterable, or 
nullif either the iterable isnullor it contains no items. 
 
 - 
 
 -