code: public final long clear(long numberToClear)
      {
          long numberRemainingToClear = numberToClear;
          // Avoid locking the Map by looking at the subMaps indivdually starting at a
          // random point in the sequence, so as not to disturb the distribution.
          int index = new java.util.Random(Thread.currentThread().hashCode()).nextInt(subMaps.length);
          int numberEmpty = 0;
          while (numberRemainingToClear > 0 && numberEmpty < subMaps.length) {
              java.util.Map subMap = subMaps[index];
              synchronized (subMap) {
                  if (!subMap.isEmpty()) {
                      java.util.Iterator iterator = subMap.entrySet().iterator();
                      iterator.next();
                      iterator.remove();
                      numberRemainingToClear--;
                      numberEmpty = 0;
                  } else {
                      numberEmpty++;
                  } // if (subMap.isEmpty()).
              } // synchronized (subMap).
  
              index++;
              if (index == subMaps.length)
                  index = 0;
          } // while (numberRemainingToClear > 0).
  
          return numberToClear - numberRemainingToClear;
      }
docs: Clear up to a specified number of elements from the the map.
  
  @param numberToClear the count of elements to clear.
  @return long the actual number cleared which is the
  lesser of size() or numberToClear.