JavaTuples getSize() method
The getSize() method in org.javatuples is used to fetch the size of the TupleClassObject. That is, it is used to fetch the number of values present in the TupleClassObject. This method can be used to any tuple class object of the javatuples library. It returns a integer value equal to the number of the elements present in the TupleClassObject.
public abstract int getSize()
int size = TupleClassObject.getSize()
Here TupleClassObject represents the JavaTuple Class object used like Unit, Quintet, Decade, etc.
Parameters: This method do not takes any parameter.
Return Value: This method returns the number of elements present in the TupleClassObject, in integer format.
Below programs illustrate the various ways to use getSize() method:
Program 1: Using getSize() with Unit class:
Size = 1
Program 2: Using getSize() with Quartet class:
Size = 4
Note: Similarly, it can be used with any other JavaTuple Class.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.