ConcurrentSkipListSet - maintains natural order of elements.
import java.util.Set;
import java.util.concurrent.ConcurrentSkipListSet;
/** Copyright (c), AnkitMittal JavaMadeSoEasy.com */
public class ConcurrentSkipListSetTest {
public static void main(String args[]) {
Set<String> concurrentSkipListSetTest = new ConcurrentSkipListSet<String>();
concurrentSkipListSetTest.add("ankit");
concurrentSkipListSetTest.add("mittal");
concurrentSkipListSetTest.add("javaMadeSoEasy");
//natural order of elements is maintained.
System.out.println("concurrentSkipListSetTest = " + concurrentSkipListSetTest);
}
}
/*OUTPUT
concurrentSkipListSetTest = [ankit, javaMadeSoEasy, mittal]
*/
|
RELATED LINKS>
ConcurrentSkipListSet - iterate using iterator, listIterator, Enumeration and enhanced for loop
ConcurrentSkipListSet - iterate using iterator, listIterator, Enumeration and enhanced for loop
ConcurrentSkipListSet - fail-safe or fail-fast iteration using iterator, listIterator, Enumeration and enhanced for loop
Labels:
Collection programs
Core Java