ConcurrentSkipListSet - adding elements, maintains natural order of elements

ConcurrentSkipListSet - maintains natural order of elements.

import java.util.Set;
import java.util.concurrent.ConcurrentSkipListSet;
/** Copyright (c), AnkitMittal */
public class ConcurrentSkipListSetTest {
   public static void main(String args[]) {
          Set<String> concurrentSkipListSetTest = new ConcurrentSkipListSet<String>();
          //natural order of elements is maintained.
          System.out.println("concurrentSkipListSetTest = " + concurrentSkipListSetTest);
concurrentSkipListSetTest = [ankit, javaMadeSoEasy, mittal]

ConcurrentSkipListSet - fail-safe or fail-fast iteration using iterator, listIterator, Enumeration and enhanced for loop

Must read for you :