JavaTuples setLabel() method Last Updated : 27 Aug, 2018 Comments Improve Suggest changes Like Article Like Report The setLabel() method in org.javatuples is used to set the label of the LabelValue Class object. This method can be used with only LabelValue class object of javatuples library. It returns another LabelValueClassObject with the Label as the element passed as the parameter, and the value from the previous LabelValueClassObject. Method Declaration: public <X> LabelValue<X, B> setLabel(X label) Syntax: LabelValue<X, B> LabelValueClassObject = LabelValue.setLabel(X label) Return Value: This method returns another LabelValueClassObject with the Label as the element passed as the parameter, and the value from the previous LabelValueClassObject. Below are programs that will illustrate the various ways to use setLabel() method: Example 1: Java // Below is a Java program to set // label in a LabelValue pair import java.util.*; import org.javatuples.LabelValue; class GfG { public static void main(String[] args) { // Creating a LabelValue object LabelValue<Integer, String> lv = LabelValue.with(Integer.valueOf(1), "A computer science portal"); // Using setLabel() method LabelValue<String, String> lv1 = lv.setLabel("GeeksforGeeks"); // Printing the returned LabelValue System.out.println(lv1); } } Output: [GeeksforGeeks, A computer science portal] Example 2: Java // Below is a Java program to set // label in a LabelValue pair import java.util.*; import org.javatuples.LabelValue; class GfG { public static void main(String[] args) { // Creating a LabelValue object LabelValue<Integer, String> lv = LabelValue.with(Integer.valueOf(1), "1"); // Using setLabel() method LabelValue<String, String> lv1 = lv.setLabel("One"); // Printing the returned LabelValue System.out.println(lv1); } } Output: [One, 1] Comment More infoAdvertise with us Next Article JavaTuples setLabel() method R RishabhPrabhu Follow Improve Article Tags : Java Java-Functions JavaTuples Practice Tags : Java Similar Reads JavaTuples setValue() method The setValue() method in org.javatuples is used to set the value in the LabelValueClassObject or KeyValueClassObject. This method can be used with only LabelValue class or KeyValue class of javatuples library. It returns another ClassObject with the value as the element passed as the parameter, and 2 min read JavaTuples setAtX() method The setAtX() method in org.javatuples is used to change the value in the existing tuple, at the index X. Since JavaTuples are immutable, hence changing a value in the existing tuple results in a new tuple with the modified value at the index X. It returns the tuple class object of the called class w 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 JavaTuples toString() method The toString() method in org.javatuples is used to convert the values in TupleClass into a String. This method is inherited from the JavaTuple class. This method can be used to any tuple class object of javatuples library. It returns a String value formed with the values in the TupleClassObject. Met 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 LinkedList set() Method in Java The Java.util.LinkedList.set() method is used to replace any particular element in the linked list created using the LinkedList class with another element. This can be done by specifying the position of the element to be replaced and the new element in the parameter of the set() method. Syntax: Link 3 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 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 Array set() method in Java The java.lang.reflect.Array.set() is an inbuilt method in Java and is used to set a specified value to a specified index of a given object array. Syntax Array.set(Object []array, int index, Object value) Parameter : array : This is an array of type Object which is to be updated. index : This is the 3 min read Java ArrayList set() Method The set() method of the ArrayList class in Java is used to replace an element at a specified position with a new value. This is very useful when we need to update an existing element in an ArrayList while maintaining the list's structure.Example 1: Here, we will use the set() method to update an ele 2 min read Like