VOOZH about

URL: https://www.geeksforgeeks.org/java/java-tuple-tolist-method/

⇱ JavaTuple toList() method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

JavaTuple toList() method

Last Updated : 11 Jul, 2025
The toList() method in org.javatuples is used to convert the values in TupleClass into a List. This List is of Object type, so that it can take all values. It is inherited from the JavaTuple class. This method can be used to any tuple class object of javatuples library. It returns List formed with the values in the TupleClassObject. Method Declaration:
public final List<Object> toList()
Syntax:
List<Object> list = TupleClassObject.toList()
Here TupleClassObject represents the JavaTuple Class object used like Unit, Quintet, Decade, etc. Return Value: This method returns a List formed with the values in the TupleClassObject. Below are programs that will illustrate the various ways to use toList() method: Program 1: Using toList() with Unit class: Output:
[GeeksforGeeks]
Program 2: Using toList() with Quartet class:
Output:
[, GeeksforGeeks, A computer portal, 20.18]
Note: Similarly, it can be used with any other JavaTuple Class.
Comment
Article Tags: