FirstItem
See javadoc - uk.gov.gchq.koryphe.impl.function.FirstItem
Available since Koryphe version 1.1.0
For a given Iterable, a FirstItem will extract the first item.
Examples
Extract first item
Java
JSON
Full JSON
Python
final FirstItem<Integer> function = new FirstItem<>();
{
"class" : "FirstItem"
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.FirstItem"
}
g.FirstItem()
Input type:
java.lang.Iterable
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.util.ArrayList | [2, 3, 5] | java.lang.Integer | 2 |
java.util.ArrayList | [7, 11, 13] | java.lang.Integer | 7 |
java.util.ArrayList | [17, 19, null] | java.lang.Integer | 17 |
java.util.ArrayList | [null, 19, 27] | null | |
null | IllegalArgumentException: Input cannot be null |