- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set Octet value in JavaTuples
To set Octet value in Java, you need to use the setAtX() method. Here, X is the index wherein you need to set the value i.e. to set value at index 1, use the setAt1() and value as a parameter.
Let us first see what we need to work with JavaTuples. To work with Octet class in JavaTuples, you need to import the following package −
import org.javatuples.Octet;
Note − Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project -> Properties -> Java Build Path -> Add External Jars and upload the downloaded JavaTuples jar file. Refer the below guide for all the steps to run JavaTuples −
Steps: How to run JavaTuples program in Eclipse
The following is an example to set Octet value in Java −
Example
import org.javatuples.Octet; public class Demo { public static void main(String[] args) { Octet<String, String, String, String, String, String, String, String> oc = Octet.with( "laptop", "desktop","mobile", "tablet","monitor", "LCD","LED", "OLED"); // index 0 System.out.println(oc.setAt0("SSD")); // index 1 System.out.println(oc.setAt1("HDD")); // index 4 System.out.println(oc.setAt4("Pen Drive")); // index 5 System.out.println(oc.setAt5("Headphone")); } }
Output
[SSD, desktop, mobile, tablet, monitor, LCD, LED, OLED] [laptop, HDD, mobile, tablet, monitor, LCD, LED, OLED] [laptop, desktop, mobile, tablet, Pen Drive, LCD, LED, OLED] [laptop, desktop, mobile, tablet, monitor, Headphone, LED, OLED]
- Related Articles
- What is Octet class in JavaTuples?
- Set Decade value in JavaTuples
- Set Ennead value in JavaTuples
- Set value in the JavaTuples KeyValue class
- Implement Ennead Class from Octet Class in Java using JavaTuples
- Implement Octet Class from Septet Class in Java using JavaTuples
- How to add a value in Octet Tuple in Java
- Add a value to Triplet class in JavaTuples
- Add a value to Septet class in JavaTuples
- Add a value to Quartet class in JavaTuples
- Set key in the JavaTuples KeyValue class
- Search for a value in Java Octet Tuple
- How to create Octet Tuple in Java?
- Fetch the value from an Octet Tuple in Java
- Search a value in JavaTuples Septet class

Advertisements