AmitDiwan has Published 10744 Articles

Implement Pair Class with Unit Class in Java using JavaTuples

AmitDiwan

AmitDiwan

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

107 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

652 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

93 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

91 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

119 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

9K+ 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

2K+ 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

HTML DOM Table deleteTFoot() Method

AmitDiwan

AmitDiwan

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

83 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

HTML DOM Table deleteCaption() Method

AmitDiwan

AmitDiwan

Updated on 19-Sep-2019 13:35:04

74 Views

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

HTML DOM Table insertRow() Method

AmitDiwan

AmitDiwan

Updated on 19-Sep-2019 13:31:16

238 Views

The HTML DOM table insertRow() method generates an empty element and adds it to the table in an HTML document.SyntaxFollowing is the syntax −object.insertRow(index)Here, index represent a number that specifies the position of the row to insert.Let us see an example of HTML DOM table insertRow() method −Example Live Demo ... Read More

Advertisements