Answers for "treeset size java"

0

TreeSet size() method in java

import java.util.TreeSet;
public class TreeSetSizeMethodExample
{
   public static void main(String[] args)
   {
      TreeSet<String> ts = new TreeSet<String>();
      ts.add("watermelon");
      ts.add("apple");
      ts.add("banana");
      ts.add("grapes");
      ts.add("mango");
      ts.add("orange");
      System.out.println("Given TreeSet: " + ts);
      // print size of TreeSet
      System.out.println("size of TreeSet is: " + ts.size());
   }
}
Posted by: Guest on October-26-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language