Implementing Quartet Using Triplet Class ”; Previous Next Problem Description How to implement Quartet class using Triplet class? Example Following example shows how to accomplish the above task. Each tuple has add() and addAtX() methods to convert the tuple. Create a java class file named TupleTester in C:>JavaTuples. File: TupleTester.java package com.tutorialspoint; import org.javatuples.Quartet; import org.javatuples.Triplet; public class TupleTester { public static void main(String args[]){ Triplet<Integer, Integer, Integer> triplet = Triplet.with(5,6,7); System.out.println(triplet); Quartet<Integer, Integer, Integer, String> quartet = triplet.add(“test”); Quartet<String, Integer, Integer, Integer> quartet1 = triplet.addAt0(“test”); System.out.println(quartet); System.out.println(quartet1); } } Verify the result Compile the classes using javac compiler as follows − C:JavaTuples>javac -cp javatuples-1.2.jar ./com/tutorialspoint/TupleTester.java Now run the TupleTester to see the result − C:JavaTuples>java -cp .;javatuples-1.2.jar com.tutorialspoint.TupleTester Output Verify the Output [5, 6, 7] [5, 6, 7, test] [test, 5, 6, 7] Print Page Previous Next Advertisements ”;
Category: javatuples
JavaTuples – KeyValue Class
JavaTuples – KeyValue Class ”; Previous Next Introduction The org.javatuples.KeyValue class represents a Tuple with two elements with positions 0 and 1 renamed as “key” and “value”, respectively. Class Declaration Following is the declaration for org.javatuples.KeyValue class − public final class KeyValue<A,B> extends Tuple implements IValue0<A>, IValue1<B> Class Constructor Sr.No. Constructor & Description 1 KeyValue(A value0, B value1) This creates a KeyValue Tuple. Class Methods Sr.No. Method & Description 1 static <X> KeyValue<X,X> fromArray(X[] array) Create tuple from array. 2 static <X> KeyValue<X,X> fromCollection(Collection<X> collection) Create tuple from collection. 3 static <X> KeyValue<X,X> fromIterable(Iterable<X> iterable) Create tuple from iterable. 4 static <X> KeyValue<X,X> fromIterable(Iterable<X> iterable, int index) Create tuple from iterable, starting from the specified index. 5 A getKey() Return the key. 6 int getSize() Return the size of the tuple. 7 A getValue() Returns the value of the tuple. 8 <X> KeyValue<X,B> setKey(X key) set the label and return the tuple. 9 <X> KeyValue<A,Y> setValue(Y value) set the value and return the tuple. 10 static <A,B> KeyValue<A,B> with(A value0, B value1) Create the tuple using given value. Methods inherite This class inherits methods from the following classes − org.javatuples.Tuple Object Example Let”s see KeyValue Class in action. Here we”ll see how to use various methods. Create a java class file named TupleTester in C:>JavaTuples. File: TupleTester.java package com.tutorialspoint; import java.util.ArrayList; import java.util.List; import org.javatuples.KeyValue; public class TupleTester { public static void main(String args[]){ KeyValue<Integer, Integer> keyValue = KeyValue.with(5,6); System.out.println(keyValue); List<Integer> list = new ArrayList<>(); list.add(1); list.add(2); Integer key = KeyValue.getKey(); System.out.println(key); Integer value = KeyValue.getValue(); System.out.println(value); KeyValue<Integer, Integer> keyValue1 = KeyValue.fromCollection(list); System.out.println(keyValue1); } } Verify the result Compile the classes using javac compiler as follows − C:JavaTuples>javac -cp javatuples-1.2.jar ./com/tutorialspoint/TupleTester.java Now run the TupleTester to see the result − C:JavaTuples>java -cp .;javatuples-1.2.jar com.tutorialspoint.TupleTester Output Verify the Output [5, 6] 5 6 [1, 2] Print Page Previous Next Advertisements ”;
JavaTuples – Pair using Unit
Implementing Pair Using Unit Class ”; Previous Next Problem Description How to implement Pair class using Unit class? Example Following example shows how to accomplish the above task. Each tuple has add() and addAtX() methods to convert the tuple. Create a java class file named TupleTester in C:>JavaTuples. File: TupleTester.java package com.tutorialspoint; import org.javatuples.Pair; import org.javatuples.Unit; public class TupleTester { public static void main(String args[]){ Unit<Integer> unit = Unit.with(5); System.out.println(unit); Pair<Integer, String> pair = unit.add(“test”); Pair<String, Integer> pair1 = unit.addAt0(“test”); System.out.println(pair); System.out.println(pair1); } } Verify the result Compile the classes using javac compiler as follows − C:JavaTuples>javac -cp javatuples-1.2.jar ./com/tutorialspoint/TupleTester.java Now run the TupleTester to see the result − C:JavaTuples>java -cp .;javatuples-1.2.jar com.tutorialspoint.TupleTester Output Verify the Output [5] [5, test] [test, 5] Print Page Previous Next Advertisements ”;
JavaTuples – Septet Class
JavaTuples – Septet Class ”; Previous Next Introduction The org.javatuples.Septet class represents a Tuple with seven elements. Class Declaration Following is the declaration for org.javatuples.Septet class − public final class Septet<A, B, C, D, E, F, G> extends Tuple implements IValue0<A>, IValue1<B>, IValue2<C>, IValue3<D>, IValue4<E>, IValue5<F>, IValue6<G> Class Constructor Sr.No. Constructor & Description 1 Septet(A value0, B value1, C value2, D value3, E value4, F value5, G value6) This creates a Septet Tuple. Class Methods Sr.No. Method & Description 1 Octet add(Unit tuple) This method returns a Octet tuple. Similarly other methods to add tuples are available e.g. add(Pair tuple) returns Ennead and upto add(Triplet tuple) returns Decade tuple. 2 Octet add(X0 value) This method add a value to the tuple and returns a Octet tuple. Similarly other methods to add values are available e.g. add(X0 value0, X1 value1) returns Ennead and so on upto add() with three parameters. 3 Octet addAt0(Unit value) This method add a Unit tuple at index 0 and returns a Octet tuple. Similarly other methods to add tuples are available e.g. addAt0(Pair value) returns Ennead and so on upto addAt0(Triplet). Other similar method are addAt1(Unit value) which add a unit at index0 and have similar methods upto addAt6(Triplet). 4 Octet addAt0(X0 value) This method add a value at index 0 and returns a Octet tuple. Similarly other methods to add values are available e.g. addAt0(X0 value0, X1 value1) returns Ennead and so on upto addAt0() with three parameters. Other similar method are addAt1(X0 value) which add a value at index0 and have similar methods upto addAt6() with three parameters. 5 static <X> Septet<X,X,X,X,X,X,X> fromArray(X[] array) Create tuple from array. 6 static <X> Septet<X,X,X,X,X,X,X> fromCollection(Collection<X> collection) Create tuple from collection. 7 static <X> Septet<X,X,X,X,X,X,X> fromIterable(Iterable<X> iterable) Create tuple from iterable. 8 static <X> Septet<X,X,X,X,X,X,X> fromIterable(Iterable<X> iterable, int index) Create tuple from iterable, starting from the specified index. 9 int getSize() Return the size of the tuple. 10 A getValue0() Returns the value of the tuple at index 0. Similarly getValue1() upto getValue6() returns the value at index 1 and so on. 11 Sextet<B,C,D,E,F,G> removeFrom0() Return the tuple after removing value of the tuple at index 0. Similarly removeFrom1() upto removeFrom6() returns the tuple after removing value of the tuple at index 1 and so on. 12 <X> Septet<X,B,C,D,E,F,G> setAt0(X value) Set the value of the tuple at index 0. Similarly setAt1() upto setAt6() set the value at index 1, and so on. 13 static <A> Septet<A,B,C,D,E,F,G> with(A value0, B value1, C value2, D value3, E value4, F value5, G value6) Create the tuple using given value. Methods inherite This class inherits methods from the following classes − org.javatuples.Tuple Object Example Let”s see Septet Class in action. Here we”ll see how to use various methods. Create a java class file named TupleTester in C:>JavaTuples. File: TupleTester.java package com.tutorialspoint; import java.util.ArrayList; import java.util.List; import org.javatuples.Septet; import org.javatuples.Sextet; import org.javatuples.Octet; public class TupleTester { public static void main(String args[]){ Septet<Integer, Integer, Integer, Integer, Integer,Integer,Integer> septet = Septet.with(5, 6, 7,8,9,10,11); System.out.println(septet); boolean isPresent = septet.contains(5); System.out.println(“5 is present: ” + isPresent); List<Integer> list = new ArrayList<>(); list.add(1); list.add(2); list.add(3); list.add(4); list.add(5); list.add(6); list.add(7); Octet<Integer, Integer, Integer, Integer, Integer, Integer, Integer, String> octet = septet.add(“Test”); System.out.println(octet); Integer value = septet.getValue0(); System.out.println(value); Sextet<Integer, Integer, Integer, Integer,Integer, Integer> sextet = septet.removeFrom0(); System.out.println(sextet); Septet<Integer, Integer, Integer, Integer, Integer,Integer, Integer> septet1 = Septet.fromCollection(list); System.out.println(septet1); } } Verify the result Compile the classes using javac compiler as follows − C:JavaTuples>javac -cp javatuples-1.2.jar ./com/tutorialspoint/TupleTester.java Now run the TupleTester to see the result − C:JavaTuples>java -cp .;javatuples-1.2.jar com.tutorialspoint.TupleTester Output Verify the Output [5, 6, 7, 8, 9, 10, 11] 5 is present: true [5, 6, 7, 8, 9, 10, 11, Test] 5 [6, 7, 8, 9, 10, 11] [1, 2, 3, 4, 5, 6, 7] Print Page Previous Next Advertisements ”;
Implementing Decade Using Ennead Class ”; Previous Next Problem Description How to implement Decade class using Ennead class? Example Following example shows how to accomplish the above task. Each tuple has add() and addAtX() methods to convert the tuple. Create a java class file named TupleTester in C:>JavaTuples. File: TupleTester.java package com.tutorialspoint; import org.javatuples.Decade; import org.javatuples.Ennead; public class TupleTester { public static void main(String args[]){ Ennead<Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer> ennead = Ennead.with(5,6,7,8,9,10,11,12,13); System.out.println(ennead); Decade<Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, String> decade = ennead.add(“test”); Decade<String, Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer> decade1 = ennead.addAt0(“test”); System.out.println(decade); System.out.println(decade1); } } Verify the result Compile the classes using javac compiler as follows − C:JavaTuples>javac -cp javatuples-1.2.jar ./com/tutorialspoint/TupleTester.java Now run the TupleTester to see the result − C:JavaTuples>java -cp .;javatuples-1.2.jar com.tutorialspoint.TupleTester Output Verify the Output [5, 6, 7, 8, 9, 10, 11, 12, 13] [5, 6, 7, 8, 9, 10, 11, 12, 13, test] [test, 5, 6, 7, 8, 9, 10, 11, 12, 13] Print Page Previous Next Advertisements ”;
JavaTuples – Ennead Class
JavaTuples – Ennead Class ”; Previous Next Introduction The org.javatuples.Ennead class represents a Tuple with nine elements. Class Declaration Following is the declaration for org.javatuples.Ennead class − public final class Ennead<A, B, C, D, E, F, G, H, I> extends Tuple implements IValue0<A>, IValue1<B>, IValue2<C>, IValue3<D>, IValue4<E>, IValue5<F>, IValue6<G>, IValue7<H>, IValue8<I> Class Constructor Sr.No. Constructor & Description 1 Ennead(A value0, B value1, C value2, D value3, E value4, F value5, G value6, H value7, I value8) This creates a Ennead Tuple. Class Methods Sr.No. Method & Description 1 Decade add(Unit tuple) This method returns a Decade tuple. 2 Decade add(X0 value) This method add a value to the tuple and returns a Decade tuple. 3 Decade addAt0(Unit value) This method add a Unit tuple at index 0 and returns a Decade tuple. Other similar method are addAt1(Unit value) which add a unit at index0 and have similar methods upto addAt8(Unit). 4 Decade addAt0(X0 value) This method add a value at index 0 and returns a Decade tuple. Other similar method are addAt1(X0 value) which add a value at index0 and have similar methods upto addAt8() with one parameter. 5 static <X> Ennead<X,X,X,X,X,X,X,X,X > fromArray(X[] array) Create tuple from array. 6 static <X> Ennead<X,X,X,X,X,X,X,X,X> fromCollection(Collection<X> collection) Create tuple from collection. 7 static <X> Ennead<X,X,X,X,X,X,X,X,X> fromIterable(Iterable<X> iterable) Create tuple from iterable. 8 static <X> Ennead<X,X,X,X,X,X,X,X> fromIterable(Iterable<X> iterable, int index) Create tuple from iterable, starting from the specified index. 9 int getSize() Return the size of the tuple. 10 A getValue0() Returns the value of the tuple at index 0. Similarly getValue1() upto getValue8() returns the value at index 1 and so on. 11 Octet<B,C,D,E,F,G,H,I> removeFrom0() Return the tuple after removing value of the tuple at index 0. Similarly removeFrom1() upto removeFrom8() returns the tuple after removing value of the tuple at index 1 and so on. 12 <X> Ennead<X,B,C,D,E,F,G,H,I> setAt0(X value) Set the value of the tuple at index 0. Similarly setAt1() upto setAt8() set the value at index 1, and so on. 13 static <A> Ennead<A,B,C,D,E,F,G,H,I> with(A value0, B value1, C value2, D value3, E value4, F value5, G value6, H value7, I value8) Create the tuple using given value. Methods inherite This class inherits methods from the following classes − org.javatuples.Tuple Object Example Let”s see Ennead Class in action. Here we”ll see how to use various methods. Create a java class file named TupleTester in C:>JavaTuples. File: TupleTester.java package com.tutorialspoint; import java.util.ArrayList; import java.util.List; import org.javatuples.Decade; import org.javatuples.Ennead; import org.javatuples.Octet; public class TupleTester { public static void main(String args[]){ Ennead<Integer, Integer, Integer, Integer, Integer, Integer,Integer,Integer, Integer> ennead = Ennead.with(5, 6, 7,8,9,10,11,12,13); System.out.println(ennead); boolean isPresent = ennead.contains(5); System.out.println(“5 is present: ” + isPresent); List<Integer> list = new ArrayList<>(); list.add(1); list.add(2); list.add(3); list.add(4); list.add(5); list.add(6); list.add(7); list.add(8); list.add(9); Decade<Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, String> decade = ennead.add(“Test”); System.out.println(decade); Integer value = ennead.getValue0(); System.out.println(value); Octet<Integer, Integer, Integer, Integer,Integer, Integer,Integer, Integer> octet = ennead.removeFrom0(); System.out.println(octet); Ennead<Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer,Integer> ennead1 = Ennead.fromCollection(list); System.out.println(ennead1); } } Verify the result Compile the classes using javac compiler as follows − C:JavaTuples>javac -cp javatuples-1.2.jar ./com/tutorialspoint/TupleTester.java Now run the TupleTester to see the result − C:JavaTuples>java -cp .;javatuples-1.2.jar com.tutorialspoint.TupleTester Output Verify the Output [5, 6, 7, 8, 9, 10, 11, 12, 13] 5 is present: true [5, 6, 7, 8, 9, 10, 11, 12, 13, Test] 5 [6, 7, 8, 9, 10, 11, 12, 13] [1, 2, 3, 4, 5, 6, 7, 8, 9] Print Page Previous Next Advertisements ”;
JavaTuples – Quartet Class
JavaTuples – Quartet Class ”; Previous Next Introduction The org.javatuples.Quartet class represents a Tuple with four elements. Class Declaration Following is the declaration for org.javatuples.Quartet class − public final class Quartet<A, B, C, D> extends Tuple implements IValue0<A>, IValue1<B>, IValue2<C>, IValue3<D> Class Constructor Sr.No. Constructor & Description 1 Quartet(A value0, B value1, C value2, D value3) This creates a Quartet Tuple. Class Methods Sr.No. Method & Description 1 Quintet add(Unit tuple) This method returns a Quintet tuple. Similarly other methods to add tuples are available e.g. add(Pair tuple) returns Sextet and upto add(Sextet tuple) returns Decade tuple. 2 Quintet add(X0 value) This method add a value to the tuple and returns a Quintet tuple. Similarly other methods to add values are available e.g. add(X0 value0, X1 value1) returns Sextet and so on upto add() with six parameters. 3 Quintet addAt0(Unit value) This method add a Unit tuple at index 0 and returns a Quintet tuple. Similarly other methods to add tuples are available e.g. addAt0(Pair value) returns Sextet and so on upto addAt0(Sextet). Other similar method are addAt1(Unit value) which add a unit at index0 and have similar methods upto addAt2(Sextet). 4 Quintet addAt0(X0 value) This method add a value at index 0 and returns a Quintet tuple. Similarly other methods to add values are available e.g. addAt0(X0 value0, X1 value1) returns Sextet and so on upto addAt0() with six parameters. Other similar method are addAt1(X0 value) which add a value at index0 and have similar methods upto addAt2() with six parameters. 5 static <X> Quartet<X,X,X,X> fromArray(X[] array) Create tuple from array. 6 static <X> Quartet<X,X,X,X> fromCollection(Collection<X> collection) Create tuple from collection. 7 static <X> Quartet<X,X,X,X> fromIterable(Iterable<X> iterable) Create tuple from iterable. 8 static <X> Quartet<X,X,X,X> fromIterable(Iterable<X> iterable, int index) Create tuple from iterable, starting from the specified index. 9 int getSize() Return the size of the tuple. 10 A getValue0() Returns the value of the tuple at index 0. Similarly getValue1() upto getValue3() returns the value at index 1 and so on. 11 Triplet<B,C,D> removeFrom0() Return the tuple after removing value of the tuple at index 0. Similarly removeFrom1() upto removeFrom3() returns the tuple after removing value of the tuple at index 1 and so on. 12 <X> Quartet<X,B,C,D> setAt0(X value) Set the value of the tuple at index 0. Similarly setAt1() upto setAt3() set the value at index 1, and so on. 13 static <A> Quartet<A,B,C,D> with(A value0, B value1, C value2, D value3) Create the tuple using given value. Methods inherite This class inherits methods from the following classes − org.javatuples.Tuple Object Example Let”s see Quartet Class in action. Here we”ll see how to use various methods. Create a java class file named TupleTester in C:>JavaTuples. File: TupleTester.java package com.tutorialspoint; import java.util.ArrayList; import java.util.List; import org.javatuples.Quartet; import org.javatuples.Quintet; import org.javatuples.Triplet; public class TupleTester { public static void main(String args[]){ Quartet<Integer, Integer, Integer, Integer> quartet = Quartet.with( 5, 6, 7,8 ); System.out.println(quartet); boolean isPresent = quartet.contains(5); System.out.println(“5 is present: ” + isPresent); List<Integer> list = new ArrayList<>(); list.add(1); list.add(2); list.add(3); list.add(4); Quintet<Integer, Integer, Integer, Integer, String> quintet = quartet.add(“Test”); System.out.println(quintet); Integer value = quartet.getValue0(); System.out.println(value); Triplet<Integer, Integer, Integer> triplet = quartet.removeFrom0(); System.out.println(triplet); Quartet<Integer, Integer, Integer, Integer> quartet1 = Quartet.fromCollection(list); System.out.println(quartet1); } } Verify the result Compile the classes using javac compiler as follows − C:JavaTuples>javac -cp javatuples-1.2.jar ./com/tutorialspoint/TupleTester.java Now run the TupleTester to see the result − C:JavaTuples>java -cp .;javatuples-1.2.jar com.tutorialspoint.TupleTester Output Verify the Output [5, 6, 7, 8] 5 is present: true [5, 6, 7, 8, Test] 5 [6, 7, 8] [1, 2, 3, 4] Print Page Previous Next Advertisements ”;
JavaTuples – Discussion
Discuss JavaTuples ”; Previous Next JavaTuples is a java library which provides the set of classes to work with tuples where tuple is a sequence of objects which may or may not be of different types. Print Page Previous Next Advertisements ”;
JavaTuples – Triplet Class
JavaTuples – Triplet Class ”; Previous Next Introduction The org.javatuples.Triplet class represents a Tuple with three elements. Class Declaration Following is the declaration for org.javatuples.Triplet class − public final class Triplet<A,B,C> extends Tuple implements IValue0<A>, IValue1<B>, IValue2<C> Class Constructors Sr.No. Constructor & Description 1 Triplet(A value0, B value1, C value2) This creates a Triplet Tuple. Class Methods Sr.No. Method & Description 1 Quartet add(Unit tuple) This method returns a Quartet tuple. Similarly other methods to add tuples are available e.g. add(Pair tuple) returns Quintet and upto add(Septet tuple) returns Decade tuple. 2 Quartet add(X0 value) This method add a value to the tuple and returns a Quartet tuple. Similarly other methods to add values are available e.g. add(X0 value0, X1 value1) returns Quintet and so on upto add() with seven parameters. 3 Quartet addAt0(Unit value) This method add a Unit tuple at index 0 and returns a Quartet tuple. Similarly other methods to add tuples are available e.g. addAt0(Pair value) returns Quintet and so on upto addAt0(Septet). Other similar method are addAt1(Unit value) which add a unit at index0 and have similar methods upto addAt2(Septet). 4 Quartet addAt0(X0 value) This method add a value at index 0 and returns a Quartet tuple. Similarly other methods to add values are available e.g. addAt0(X0 value0, X1 value1) returns Quintet and so on upto addAt0() with seven parameters. Other similar method are addAt1(X0 value) which add a value at index0 and have similar methods upto addAt2() with seven parameters. 5 static <X> Triplet<X,X,X> fromArray(X[] array) Create tuple from array. 6 static <X> Triplet<X,X,X> fromCollection(Collection<X> collection) Create tuple from collection. 7 static <X> Triplet<X,X,X> fromIterable(Iterable<X> iterable) Create tuple from iterable. 8 static <X> Triplet<X,X,X> fromIterable(Iterable<X> iterable, int index) Create tuple from iterable, starting from the specified index. 9 int getSize() Return the size of the tuple. 10 A getValue0() Returns the value of the tuple at index 0. Similarly getValue1() upto getValue2() returns the value at index 1 and so on. 11 Pair<B,C> removeFrom0() Return the tuple after removing value of the tuple at index 0. Similarly removeFrom1() upto removeFrom2() returns the tuple after removing value of the tuple at index 1 and so on. 12 <X> Triplet<X,B,C> setAt0(X value) Set the value of the tuple at index 0. Similarly setAt1() upto setAt2() set the value at index 1 and so on. 13 static <A> Triplet<A,B,C> with(A value0, B value1, C value2) Create the tuple using given value. Methods inherite This class inherits methods from the following classes − org.javatuples.Tuple Object Example Let”s see Triplet Class in action. Here we”ll see how to use various methods. Create a java class file named TupleTester in C:>JavaTuples. File: TupleTester.java package com.tutorialspoint; import java.util.ArrayList; import java.util.List; import org.javatuples.Pair; import org.javatuples.Quartet; import org.javatuples.Triplet; public class TupleTester { public static void main(String args[]){ Triplet<Integer, Integer, Integer> triplet = Triplet.with(5, 6, 7); System.out.println(triplet); boolean isPresent = triplet.contains(5); System.out.println(“5 is present: ” + isPresent); List<Integer> list = new ArrayList<>(); list.add(1); list.add(2); list.add(3); Quartet<Integer, Integer, Integer, String> quartet = triplet.add(“Test”); System.out.println(quartet); Integer value = triplet.getValue0(); System.out.println(value); Pair<Integer, Integer> pair = triplet.removeFrom0(); System.out.println(pair); Triplet<Integer, Integer, Integer> triplet1 = Triplet.fromCollection(list); System.out.println(triplet1); } } Verify the result Compile the classes using javac compiler as follows − C:JavaTuples>javac -cp javatuples-1.2.jar ./com/tutorialspoint/TupleTester.java Now run the TupleTester to see the result − C:JavaTuples>java -cp .;javatuples-1.2.jar com.tutorialspoint.TupleTester Output Verify the Output [5, 6, 7] 5 is present: true [5, 6, 7, Test] 5 [6, 7] [1, 2, 3] Print Page Previous Next Advertisements ”;
Implementing Septet using Sextet Class ”; Previous Next Problem Description How to implement Septet class using Sextet class? Example Following example shows how to accomplish the above task. Each tuple has add() and addAtX() methods to convert the tuple. Create a java class file named TupleTester in C:>JavaTuples. File: TupleTester.java package com.tutorialspoint; import org.javatuples.Septet; import org.javatuples.Sextet; public class TupleTester { public static void main(String args[]){ Sextet<Integer, Integer, Integer, Integer, Integer, Integer> sextet = Sextet.with(5,6,7,8,9,10); System.out.println(sextet); Septet<Integer, Integer, Integer, Integer, Integer, Integer, String> septet = sextet.add(“test”); Septet<String, Integer, Integer, Integer, Integer, Integer, Integer> septet1 = sextet.addAt0(“test”); System.out.println(septet); System.out.println(septet1); } } Verify the result Compile the classes using javac compiler as follows − C:JavaTuples>javac -cp javatuples-1.2.jar ./com/tutorialspoint/TupleTester.java Now run the TupleTester to see the result − C:JavaTuples>java -cp .;javatuples-1.2.jar com.tutorialspoint.TupleTester Output Verify the Output [5, 6, 7, 8, 9, 10] [5, 6, 7, 8, 9, 10, test] [test, 5, 6, 7, 8, 9, 10] Print Page Previous Next Advertisements ”;