This topic is about Implementing Sextet Using Quintet Class.
Problem Description
How to implement Sextet class using Quintet 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.Adglob; import org.javatuples.Quintet; import org.javatuples.Sextet; public class TupleTester { public static void main(String args[]){ Quintet<Integer, Integer, Integer, Integer, Integer> quintet = Quintet.with(5,6,7,8,9); System.out.println(quintet); Sextet<Integer, Integer, Integer, Integer, Integer, String> sextet = quintet.add("test"); Sextet<String, Integer, Integer, Integer, Integer, Integer> sextet1 = quintet.addAt0("test"); System.out.println(sextet); System.out.println(sextet1); } }
Verify the result
Compile the classes using javac compiler as follows −
C:\JavaTuples>javac -cp javatuples-1.2.jar ./com/Adglob/TupleTester.java
Now run the TupleTester to see the result −
C:\JavaTuples>java -cp .;javatuples-1.2.jar com.Adglob.TupleTester
Output
Verify the Output
[5, 6, 7, 8, 9] [5, 6, 7, 8, 9, test] [test, 5, 6, 7, 8, 9]
In this topic we learned about Implementing Sextet Using Quintet Class. To know more, Click Here.
Pingback: Implementing Quintet Using Quartet Class - Adglob Infosystem Pvt Ltd