AmitDiwan has Published 11365 Articles

Implement Triplet Class with Pair Class in Java using JavaTuples

AmitDiwan

AmitDiwan

Updated on 20-Sep-2019 07:52:17

66 Views

At first, create a Pair class −Pairpair = new Pair(Integer.valueOf(25), "green");Now, implement Triplet class with Pair class −Triplet triplet = pair.add("magenta");Following is an example to implement Triplet class with Pair class in Java −Exampleimport org.javatuples.Pair; import org.javatuples.Triplet; public class MyDemo {    public static void main(String[] args) {     ... Read More

Implement Pair Class with Unit Class in Java using JavaTuples

AmitDiwan

AmitDiwan

Updated on 20-Sep-2019 07:44:41

54 Views

Following is an example to implement Pair class from Unit class in Java −Exampleimport org.javatuples.Unit; import org.javatuples.Pair; public class MyDemo {    public static void main(String[] args) {       Unit unit = Unit.with("Tutorial");       System.out.println("Unit class element: " + unit);       Pair pair = ... Read More

How to sort an ArrayList in Descending Order in Java

AmitDiwan

AmitDiwan

Updated on 20-Sep-2019 07:42:31

541 Views

To sort an ArrayList, you need to use the Collections.sort() method. This sorts in ascending order, but if you want to sort the ArrayList in descending order, use the Collections.reverseOrder() method as well. This gets included as a parameter −Collections.sort(myList, Collections.reverseOrder());Following is the code to sort an ArrayList in descending ... Read More

Implement Octet Class from Septet Class in Java using JavaTuples

AmitDiwan

AmitDiwan

Updated on 20-Sep-2019 07:40:07

55 Views

At first create Septet and add elements −Septet    septet = new Septet(    "Laptop", "Desktop", "Tablet", "Notebook", "Phone", "Reader", "LCD");Now, implement Octet from Septet −Octet octet = septet.add("LED");Following is an example to implement Octet class from Septet class in Java −Exampleimport org.javatuples.Septet; import org.javatuples.Octet; public class MyDemo {   ... Read More

Implement Ennead Class from Octet Class in Java using JavaTuples

AmitDiwan

AmitDiwan

Updated on 20-Sep-2019 07:37:27

59 Views

Following is an example to implement Ennead class from Octet class in Java −Exampleimport org.javatuples.Octet; import org.javatuples.Ennead; public class MyDemo {    public static void main(String[] args) {       Octet          octet = new Octet(          "Jack", "Tom", "Steve", "Tim", "Nathan", "Ryan", ... Read More

Implement Decade Class from Ennead Class in Java using JavaTuples

AmitDiwan

AmitDiwan

Updated on 20-Sep-2019 07:34:59

64 Views

Following is an example to implement Decade Class from Ennead Class in Java using JavaTuples −Exampleimport org.javatuples.Decade; import org.javatuples.Ennead; public class MyDemo {    public static void main(String[] args) {       Ennead e =          Ennead.with("Katie", "Tom", "Ryan", "Tom", "Bradley", "David", "Steve", "Brad", "Jacob");   ... Read More

How to sort TreeSet in descending order in Java?

AmitDiwan

AmitDiwan

Updated on 20-Sep-2019 07:28:17

8K+ Views

To sort TreeSet in descending order, use the descendingSet() method in Java.The descendingSet() method is used to return a reverse order view of the elements contained in this set.At first, create a TreeSet −TreeSet treeSet = new TreeSet();Then add some elements −treeSet.add(45); treeSet.add(15); treeSet.add(99); treeSet.add(70);Sort them indecreasing order −TreeSet res = (TreeSet)treeSet.descendingSet();Following ... Read More

How to sort HashSet in Java

AmitDiwan

AmitDiwan

Updated on 20-Sep-2019 07:15:36

1K+ Views

To sort HashSet in Java, you can use another class, which is TreeSet.Following is the code to sort HashSet in Java −Example Live Demoimport java.util.*; public class Main {    public static void main(String args[]) {       Set hashSet = new HashSet();       hashSet.add("green");       ... Read More

How to sort an ArrayList in Ascending Order in Java

AmitDiwan

AmitDiwan

Updated on 20-Sep-2019 06:52:54

844 Views

To sort an ArrayList in ascending order, the easiest way is to the Collections.sort() method. With this method, you just need to set the ArrayList as the parameter as shown below −Collections.sort(ArrayList)Let us now see an example to sort an ArrayList un ascending order. Here, we are sorting ArrayList with ... Read More

HTML DOM Table deleteTFoot() Method

AmitDiwan

AmitDiwan

Updated on 19-Sep-2019 13:38:33

51 Views

The HTML DOM table deleteTFoot() method delete the element from the table in an HTML document.SyntaxFollowing is the syntax −object.deleteTFoot()Let us see an example of HTML DOM table deleteTFoot() method −Example Live Demo    body {       color: #000;       background: lightblue;     ... Read More

Advertisements