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