Length
See javadoc - uk.gov.gchq.koryphe.impl.function.Length
Available since Koryphe version 1.3.0
Attempts to returns the length of an object
Examples
Get length
Java
JSON
Full JSON
Python
final Length function = new Length();{
"class" : "Length"
}{
"class" : "uk.gov.gchq.koryphe.impl.function.Length"
}g.Length()Input type:
java.lang.Object
Example inputs:
| Input Type | Input | Result Type | Result |
|---|---|---|---|
| java.util.ArrayList | [Entity[vertex=1,group=entity,properties=Properties[]], Entity[vertex=2,group=entity,properties=Properties[]], Entity[vertex=3,group=entity,properties=Properties[]], Entity[vertex=4,group=entity,properties=Properties[]], Entity[vertex=5,group=entity,properties=Properties[]]] | java.lang.Integer | 5 |
| java.util.HashMap | {option3=value3, option1=value1, option2=value2} | java.lang.Integer | 3 |
| uk.gov.gchq.gaffer.data.graph.Walk | [[Edge[source=A,destination=B,directed=true,group=BasicEdge,properties=Properties[]]], [Edge[source=B,destination=C,directed=true,group=EnhancedEdge,properties=Properties[]], Edge[source=B,destination=C,directed=true,group=BasicEdge,properties=Properties[]]], [Edge[source=C,destination=A,directed=true,group=BasicEdge,properties=Properties[]]], [Edge[source=A,destination=E,directed=true,group=BasicEdge,properties=Properties[]]]] | java.lang.Integer | 4 |
| java.lang.Integer | 5 | IllegalArgumentException: Could not determine the size of the provided value | |
| java.lang.String | some string | java.lang.Integer | 11 |
| [Ljava.lang.String; | [1, 2] | java.lang.Integer | 2 |
| null | java.lang.Integer | 0 |