This topic is about Implementing Octet using Septet Class.
Problem Description
How to implement Octet class using Septet 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.Octet; import org.javatuples.Septet; 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); Octet<Integer, Integer, Integer, Integer, Integer, Integer, Integer, String> octet = septet.add("test"); Octet<String, Integer, Integer, Integer, Integer, Integer, Integer, Integer> octet1 = septet.addAt0("test"); System.out.println(octet); System.out.println(octet1); } }
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, 10, 11] [5, 6, 7, 8, 9, 10, 11, test] [test, 5, 6, 7, 8, 9, 10, 11]
In this topic we learned about Implementing Octet using Septet Class. To know more, Click Here.
Pingback: Implementing Septet using Sextet Class - Adglob Infosystem Pvt Ltd