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[]){
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.Triplet;
import org.javatuples.Pair;
public class TupleTester {
public static void main(String args[]){
Learn Java in-depth with real-world projects through our Java certification course. Enroll and become a certified expert to boost your career.
Class Constructor
Sr.No.
Constructor & Description
1
Decade(A value0, B value1, C value2, D value3, E value4, F value5, G value6, H value7, I value8, I value9 )This creates a Decade Tuple.
Class Methods
Similarly setAt1() upto setAt9() set the value at index 1, and so on.
Sr.No.
Method & Description
1
static <X> Decade<X,X,X,X,X,X,X,X,X,X > fromArray(X[] array)Create tuple from array.
2
static <X> Decade<X,X,X,X,X,X,X,X,X,X> fromCollection(Collection<X> collection)Create tuple from collection.
3
static <X> Decade<X,X,X,X,X,X,X,X,X,X> fromIterable(Iterable<X> iterable)Create tuple from iterable.
4
static <X> Decade<X,X,X,X,X,X,X,X,X> fromIterable(Iterable<X> iterable, int index)Create tuple from iterable, starting from the specified index.
5
int getSize()Return the size of the tuple.
6
A getValue0()Returns the value of the tuple at index 0.Similarly getValue1() upto getValue9() returns the value at index 1 and so on.
7
Ennead<B,C,D,E,F,G,H,I,J> removeFrom0()Return the tuple after removing value of the tuple at index 0.Similarly removeFrom1() upto removeFrom9() returns the tuple after removing value of the tuple at index 1 and so on.
8
<X> Decade<X,B,C,D,E,F,G,H,I,J> setAt0(X value)Set the value of the tuple at index 0.
9
static <A> Decade<A,B,C,D,E,F,G,H,I,J> with(A value0, B value1, C value2, D value3, E value4, F value5, G value6, H value7, I value8, I value9)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;
public class TupleTester {
public static void main(String args[]){
Learn Java in-depth with real-world projects through our Java certification course. Enroll and become a certified expert to boost your career.
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
Similarly setAt1() upto setAt8() set the value at index 1, and so on.
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.
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[]){
Learn Java in-depth with real-world projects through our Java certification course. Enroll and become a certified expert to boost your career.
Class Constructor
Sr.No.
Constructor & Description
1
Octet(A value0, B value1, C value2, D value3, E value4, F value5, G value6, H value7)This creates a Octet Tuple.
Class Methods
Similarly setAt1() upto setAt7() set the value at index 1, and so on.
Sr.No.
Method & Description
1
Ennead add(Unit tuple)This method returns a Ennead tuple.Similarly other methods to add tuples are available e.g. add(Pair tuple) returns Decade.
2
Ennead add(X0 value)This method add a value to the tuple and returns a Ennead tuple.Similarly other methods to add values are available e.g. add(X0 value0, X1 value1) returns Decade.
3
Ennead addAt0(Unit value)This method add a Unit tuple at index 0 and returns a Ennead tuple.Similarly other methods to add tuples are available e.g. addAt0(Pair value) returns Decade. Other similar method are addAt1(Unit value) which add a unit at index0 and have similar methods upto addAt7(Pair).
4
Ennead addAt0(X0 value)This method add a value at index 0 and returns a Ennead tuple.Similarly other methods to add values are available e.g. addAt0(X0 value0, X1 value1) returns Decade. Other similar method are addAt1(X0 value) which add a value at index0 and have similar methods upto addAt7() with two parameters.
5
static <X> Octet<X,X,X,X,X,X,X,X> fromArray(X[] array)Create tuple from array.
6
static <X> Octet<X,X,X,X,X,X,X,X> fromCollection(Collection<X> collection)Create tuple from collection.
7
static <X> Octet<X,X,X,X,X,X,X,X> fromIterable(Iterable<X> iterable)Create tuple from iterable.
8
static <X> Octet<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 getValue7() returns the value at index 1 and so on.
11
Septet<B,C,D,E,F,G,H> removeFrom0()Return the tuple after removing value of the tuple at index 0.Similarly removeFrom1() upto removeFrom7() returns the tuple after removing value of the tuple at index 1 and so on.
12
<X> Octet<X,B,C,D,E,F,G,H> setAt0(X value)Set the value of the tuple at index 0.
13
static <A> Octet<A,B,C,D,E,F,G,H> with(A value0, B value1, C value2, D value3, E value4, F value5, G value6, H value7)Create the tuple using given value.
Methods inherite
This class inherits methods from the following classes −
org.javatuples.Tuple
Object
Example
Let’s see Octet 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.Ennead;
import org.javatuples.Octet;
import org.javatuples.Septet;
public class TupleTester {
public static void main(String args[]){
Learn Java in-depth with real-world projects through our Java certification course. Enroll and become a certified expert to boost your career.
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
Similarly setAt1() upto setAt6() set the value at index 1, and so on.
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.
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[]){
Learn Java in-depth with real-world projects through our Java certification course. Enroll and become a certified expert to boost your career.
Class Constructor
Sr.No.
Constructor & Description
1
Sextet(A value0, B value1, C value2, D value3, E value4, F value5)This creates a Sextet Tuple.
Class Methods
Similarly setAt1() upto setAt5() set the value at index 1, and so on.
Sr.No.
Method & Description
1
Septet add(Unit tuple)This method returns a Septet tuple.Similarly other methods to add tuples are available e.g. add(Pair tuple) returns Octet and upto add(Quartet tuple) returns Decade tuple.
2
Septet add(X0 value)This method add a value to the tuple and returns a Septet tuple.Similarly other methods to add values are available e.g. add(X0 value0, X1 value1) returns Octet and so on upto add() with four parameters.
3
Septet addAt0(Unit value)This method add a Unit tuple at index 0 and returns a Septet tuple.Similarly other methods to add tuples are available e.g. addAt0(Pair value) returns Octet and so on upto addAt0(Quartet). Other similar method are addAt1(Unit value) which add a unit at index0 and have similar methods upto addAt5(Quartet).
4
Septet addAt0(X0 value)This method add a value at index 0 and returns a Septet tuple.Similarly other methods to add values are available e.g. addAt0(X0 value0, X1 value1) returns Octet and so on upto addAt0() with four parameters. Other similar method are addAt1(X0 value) which add a value at index0 and have similar methods upto addAt5() with four parameters.
5
static <X> Sextet<X,X,X,X,X,X> fromArray(X[] array)Create tuple from array.
6
static <X> Sextet<X,X,X,X,X,X> fromCollection(Collection<X> collection)Create tuple from collection.
7
static <X> Sextet<X,X,X,X,X,X> fromIterable(Iterable<X> iterable)Create tuple from iterable.
8
static <X> Sextet<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 getValue5() returns the value at index 1 and so on.
11
Quintet<B,C,D,E,F> removeFrom0()Return the tuple after removing value of the tuple at index 0.Similarly removeFrom1() upto removeFrom5() returns the tuple after removing value of the tuple at index 1 and so on.
12
<X> Sextet<X,B,C,D,E,F> setAt0(X value)Set the value of the tuple at index 0.
13
static <A> Sextet<A,B,C,D,E,F> with(A value0, B value1, C value2, D value3, E value4, F value5)Create the tuple using given value.
Methods inherite
This class inherits methods from the following classes −
org.javatuples.Tuple
Object
Example
Let’s see Sextet 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.Sextet;
import org.javatuples.Septet;
public class TupleTester {
public static void main(String args[]){