コード例 #1
0
 /** {@inheritDoc} */
 @Override
 public boolean forEachEntry(TCharCharProcedure procedure) {
   TByteOffheapArray states = _states;
   TCharOffheapArray keys = _set;
   TCharOffheapArray values = _values;
   for (int i = capacity(); i-- > 0; ) {
     if (states.get(i) == FULL && !procedure.execute(keys.get(i), values.get(i))) {
       return false;
     }
   }
   return true;
 }
コード例 #2
0
  /** {@inheritDoc} */
  @Override
  public boolean retainEntries(TCharCharProcedure procedure) {
    boolean modified = false;
    TByteOffheapArray states = _states;
    TCharOffheapArray keys = _set;
    TCharOffheapArray values = _values;

    // Temporarily disable compaction. This is a fix for bug #1738760
    tempDisableAutoCompaction();
    try {
      for (int i = capacity(); i-- > 0; ) {
        if (states.get(i) == FULL && !procedure.execute(keys.get(i), values.get(i))) {
          removeAt(i);
          modified = true;
        }
      }
    } finally {
      reenableAutoCompaction(true);
    }

    return modified;
  }