Code example for AtomicReferenceArray

0
      Segment(int initialCapacity) {
        setTable(newEntryArray(initialCapacity));
      } 
 
      AtomicReferenceArray<E> newEntryArray(int size) {
        return new AtomicReferenceArray<E>(size);
      } 
 
      /** 
       * Sets table to new HashEntry array. Call only while holding lock or in 
       * constructor. 
       */ 
      void setTable(AtomicReferenceArray<E> newTable) {
        this.threshold = newTable.length() * 3 / 4;
        this.table = newTable;
      } 
 
      /** 
       * Returns properly casted first entry of bin for given hash. 
       */ 
      E getFirst(int hash) {