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