instanceof java
Posts: 576
Nickname: instanceof
Registered: Jan, 2015
instanceof java is a java related one.
Get Size of Java TreeSet Example
Posted: Mar 8, 2016 10:11 AM
This post originated from an RSS feed registered with Java Buzz
by instanceof java.
Original Post: Get Size of Java TreeSet Example
Feed Title: Instance Of Java
Feed URL: http://feeds.feedburner.com/blogspot/TXghwE
Feed Description: Instance of Java. A place where you can learn java in simple way each and every topic covered with many points and sample programs.
Latest Java Buzz Posts
Latest Java Buzz Posts by instanceof java
Latest Posts From Instance Of Java
Advertisement
1.Basic Java example program get size of treeset package com.TreeSetExamplePrograms; public Class TreeSetGetSizeDemo{ public static void main(String args[]) { //create TreeSet object TreeSet<String> treeSet = new TreeSet<String>(); //add elements to TreeSet treeSet.add("I"); treeSet.add("N"); treeSet.add("S"); treeSet.add("T"); treeSet.add("A"); treeSet.add("N"); treeSet.add("C"); treeSet.add("E"); treeSet.add("O"); treeSet.add("F"); System.out.println(treeSet); System.out.println("Size of TreeSet : " + treeSet.size()); //remove one element from TreeSet using remove method treeSet.remove("A"); System.out.println("Size of TreeSet after removal of element A : " + treeSet.size()); System.out.println(treeSet); } } Output: [A, C, E, F, I, N, O, S, T] Size of TreeSet : 9 Size of TreeSet after removal of element A : 8 [C, E, F, I, N, O, S, T]
Read: Get Size of Java TreeSet Example