Added till 18th
This commit is contained in:
16
TreeSet18b.java
Normal file
16
TreeSet18b.java
Normal file
@@ -0,0 +1,16 @@
|
||||
// write a java code to demonstrate treeset
|
||||
import java.util.*;
|
||||
public class TreeSet18b {
|
||||
public static void main(String args[]){
|
||||
TreeSet<String> home = new TreeSet<String>();
|
||||
home.add("Hall Room");
|
||||
home.add("Bed Room");
|
||||
home.add(null);
|
||||
home.add("Bed Room");
|
||||
home.add("Kitchen");
|
||||
Iterator<String> itr = home.iterator();
|
||||
while(itr.hasNext()){
|
||||
System.out.println(itr.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user