IterableFlatten
See javadoc - uk.gov.gchq.koryphe.impl.function.IterableFlatten
Available since Koryphe version 1.9.0
Combines the items in an iterable into a single item based on the supplied operator.
Examples
With no binary operator
Java
JSON
Full JSON
Python
final IterableFlatten function = new IterableFlatten(null);
{
"class" : "IterableFlatten"
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.IterableFlatten"
}
g.IterableFlatten()
Input type:
java.lang.Iterable
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.util.ArrayList | [a, b, c] | null |
With a binary operator
Java
JSON
Full JSON
Python
final IterableFlatten function = new IterableFlatten<>(new Max());
{
"class" : "IterableFlatten",
"operator" : {
"class" : "uk.gov.gchq.koryphe.impl.binaryoperator.Max"
}
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.IterableFlatten",
"operator" : {
"class" : "uk.gov.gchq.koryphe.impl.binaryoperator.Max"
}
}
g.IterableFlatten(
operator=g.Max()
)
Input type:
java.lang.Iterable
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.util.ArrayList | [1, 2, 3, 1] | java.lang.Integer | 3 |
java.util.ArrayList | [1, null, 6] | java.lang.Integer | 6 |
java.util.ArrayList | [] | null | |
null | null |