Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsSynchronizedNavigableSetExample4 { public static void main(String[] args) { NavigableSet
set = new TreeSet<>(); set.add(1001); set.add(1002); set.add(1003); set.add(1004); set.add(1005); System.out.println("Set before Synchronized navigable set: " + set); Collections.synchronizedNavigableSet(set); Iterator
itr=set.iterator(); System.out.println("Set after Synchronized navigable set-"); while(itr.hasNext()){ System.out.println(itr.next()); } } }
Output