JavaTuples getKey() method Last Updated : 27 Aug, 2018 Comments Improve Suggest changes Like Article Like Report The getKey() method in org.javatuples is used to fetch the key from the TupleClassObject from the KeyValue Class. This method can be used with only KeyValue class object of javatuples library. It returns a Key which is the element present at the index 0 of the KeyValueClassObject. The returned Key is ensures the type-safety. Method Declaration: public A getKey() Syntax: KeyValue<A, B> KeyValueClassObject = KeyValue.with(A a, B b); A val = KeyValueClassObject.getKey() Return Value: This method returns a Key which is the element present at the index 0 of the KeyValueClassObject. Below programs illustrate the various ways to use getKey() method: Example 1: Java // Below is a Java program to get // a KeyValue value import java.util.*; import org.javatuples.KeyValue; class GfG { public static void main(String[] args) { // Creating a KeyValue object KeyValue<Integer, String> kv = KeyValue.with(Integer.valueOf(1), "GeeksforGeeks"); // Using getKey() method int key = kv.getKey(); // Printing the Key System.out.println(key); } } Output: 1 Example 2: Java // Below is a Java program to get // a KeyValue value import java.util.*; import org.javatuples.KeyValue; class GfG { public static void main(String[] args) { // Creating a KeyValue object KeyValue<String, String> kv = KeyValue.with("GeeksforGeeks", "A Computer Science Portal for Geeks"); // Using getKey() method String key = kv.getKey(); // Printing the Key System.out.println(key); } } Output: GeeksforGeeks Comment More infoAdvertise with us Next Article JavaTuples getKey() method R RishabhPrabhu Follow Improve Article Tags : Java Java-Functions JavaTuples Practice Tags : Java Similar Reads JavaTuples getValue() method The getValue() method in org.javatuples is used to fetch the value of the TupleClassObject from the index passed as the parameter. This method can be used to any tuple class object of javatuples library. It returns a Object value which is the element present at the index, passed as parameter, of the 2 min read JavaTuples getLabel() method The getLabel() method in org.javatuples is used to fetch the label from the TupleClassObject from the LabelValue Class. This method can be used with only LabelValue class object of javatuples library. It returns a Label which is the element present at the index 0 of the LabelValueClassObject. The re 2 min read JavaTuple getValueX() method The getValueX() method in org.javatuples is used to fetch the value of the TupleClassObject from the index X. This method can be used to any tuple class object of javatuples library. It returns the value at index X of the TupleClassObject. The returned Value is of the type of Xth element of the Tupl 2 min read JavaTuples hashcode() method The hashCode() method in org.javatuples method returns the hash code for the JavaTuple class object. The hashcode is always the same if the object doesn't change. Hashcode is a unique code generated by the JVM at time of object creation. It can be used to perform some operation on hashing related al 2 min read JavaTuples setKey() method The setKey() method in org.javatuples is used to set the key of the KeyValue Class object. This method can be used with only KeyValue class object of javatuples library. It returns another KeyValueClassObject with the Key as the element passed as the parameter, and the value from the previous KeyVal 2 min read LinkedList get() Method in Java In Java, the get() method of LinkedList is used to fetch or retrieve an element at a specific index from a LinkedList.Example 1: Here, we use the get() method to retrieve an element at a specified index.Java// Java Program to illustrate get() method import java.util.LinkedList; public class Geeks { 2 min read Java String getBytes() Method In Java, the getBytes() method of the String class converts a string into an array of bytes. This method is useful for encoding the strings into binary format, which can then be used for file I/O, network transmission, or encryption. It can be used with the default character set or with a specified 2 min read Hashtable get() Method in Java The Hashtable.get() method is a built-in method of the java.util.Hashtable class. This method is used to retrieve or fetch the value mapped by a particular key mentioned in the parameter. It returns NULL when the table contains no such mapping for the key. In this article, we will learn about the Ha 3 min read Vector get() Method in Java The java.util.vector.get() method is used to fetch or retrieve an element at a specific index from a Vector. Syntax: Vector.get(int index) Parameters: This method accepts a mandatory parameter index which is of integer data type. It specifies the position or index of the element to be fetched from t 2 min read Java Map equals() Method The equals() method of Map interface in Java is used to check if two maps are equal. Two maps are considered equal if they meet the following conditions. Both maps must have the same size.Both maps must contain identical key-value pairs. (It means every key in one map must be associated with the sam 2 min read Like