The easiest way to create a tuple is to use the from() static method. This method is overloaded for tuples of one to ten elements, and returns one of the named tuple types.

Triple<String,String,Integer> cityPopulation =
    Tuple.from("NM", "Albuquerque", 494236);

This method only works for tuples of limited size. If you want to create tuples of larger sizes, then use the prepend() method. prepend() adds an element to the beginning of another tuple. Rather than modifying the existing tuple, it returns a new one.

The type returned by the prepend() method is a nested Tuple generic type. The Tuple generic type takes two parameters, the type of the first element, and the type of the rest of the elements. The second parameter is itself a Tuple. The last type in the nested list is End.

Tuple<Double,Tuple<Integer,Tuple<String,End>>> t1 =
    Tuple.from("c").prepend(2).prepend(2.3);

Although this method is more flexible, it is more difficult syntax. The elements must be added to the tuple in reverse order. And the type is expressed in its fully exploded form. If you must use this syntax, then take full advantage of Eclipse's refactoring tools to generate type declarations.