/** * Applies a procedure to each element of the receiver, if any. * Starts at index 0, moving rightwards. * @param procedure the procedure to be applied. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues. * @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise. */ public boolean forEach(LongProcedure procedure) { // overridden for performance only. long[] theElements = elements; int theSize = size; for (int i=0; i<theSize;) if (! procedure.apply(theElements[i++])) return false; return true; } /**
/** * Applies a procedure to each element of the receiver, if any. * Starts at index 0, moving rightwards. * @param procedure the procedure to be applied. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues. * @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise. */ public boolean forEach(LongProcedure procedure) { // overridden for performance only. long[] theElements = elements; int theSize = size; for (int i=0; i<theSize;) if (! procedure.apply(theElements[i++])) return false; return true; } /**
/** * Applies a procedure to each key of the receiver, if any. * Note: Iterates over the keys in no particular order. * Subclasses can define a particular order, for example, "sorted by key". * All methods which <i>can</i> be expressed in terms of this method (most methods can) <i>must guarantee</i> to use the <i>same</i> order defined by this method, even if it is no particular order. * This is necessary so that, for example, methods <tt>keys</tt> and <tt>values</tt> will yield association pairs, not two uncorrelated lists. * * @param procedure the procedure to be applied. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues. * @return <tt>false</tt> if the procedure stopped before all keys where iterated over, <tt>true</tt> otherwise. */ public boolean forEachKey(LongProcedure procedure) { for (int i = table.length ; i-- > 0 ;) { if (state[i]==FULL) if (! procedure.apply(table[i])) return false; } return true; } /**
/** * Applies a procedure to each key of the receiver, if any. * Note: Iterates over the keys in no particular order. * Subclasses can define a particular order, for example, "sorted by key". * All methods which <i>can</i> be expressed in terms of this method (most methods can) <i>must guarantee</i> to use the <i>same</i> order defined by this method, even if it is no particular order. * This is necessary so that, for example, methods <tt>keys</tt> and <tt>values</tt> will yield association pairs, not two uncorrelated lists. * * @param procedure the procedure to be applied. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues. * @return <tt>false</tt> if the procedure stopped before all keys where iterated over, <tt>true</tt> otherwise. */ public boolean forEachKey(LongProcedure procedure) { for (int i = table.length ; i-- > 0 ;) { if (state[i]==FULL) if (! procedure.apply(table[i])) return false; } return true; } /**
/** * Applies a procedure to each element of the receiver, if any. Starts at * index 0, moving rightwards. * * @param procedure * the procedure to be applied. Stops iteration if the procedure * returns <tt>false</tt>, otherwise continues. * @return <tt>false</tt> if the procedure stopped before all elements where * iterated over, <tt>true</tt> otherwise. */ public boolean forEach(LongProcedure procedure) { // overridden for performance only. long[] theElements = elements; int theSize = size; for (int i = 0; i < theSize;) if (!procedure.apply(theElements[i++])) return false; return true; }
/** * Applies a procedure to each key of the receiver, if any. Note: Iterates * over the keys in no particular order. Subclasses can define a particular * order, for example, "sorted by key". All methods which <i>can</i> be * expressed in terms of this method (most methods can) <i>must * guarantee</i> to use the <i>same</i> order defined by this method, even * if it is no particular order. This is necessary so that, for example, * methods <tt>keys</tt> and <tt>values</tt> will yield association pairs, * not two uncorrelated lists. * * @param procedure * the procedure to be applied. Stops iteration if the procedure * returns <tt>false</tt>, otherwise continues. * @return <tt>false</tt> if the procedure stopped before all keys where * iterated over, <tt>true</tt> otherwise. */ public boolean forEachKey(LongProcedure procedure) { for (int i = table.length; i-- > 0;) { if (state[i] == FULL) if (!procedure.apply(table[i])) return false; } return true; }
/** * Applies a procedure to each element of the receiver, if any. * Starts at index 0, moving rightwards. * @param procedure the procedure to be applied. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues. * @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise. */ public boolean forEach(LongProcedure procedure) { for (int i=0; i<size;) if (! procedure.apply(get(i++))) return false; return true; } /**
/** * Applies a procedure to each element of the receiver, if any. * Starts at index 0, moving rightwards. * @param procedure the procedure to be applied. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues. * @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise. */ public boolean forEach(LongProcedure procedure) { for (int i=0; i<size;) if (! procedure.apply(get(i++))) return false; return true; } /**
/** * Applies a procedure to each element of the receiver, if any. Starts at * index 0, moving rightwards. * * @param procedure * the procedure to be applied. Stops iteration if the procedure * returns <tt>false</tt>, otherwise continues. * @return <tt>false</tt> if the procedure stopped before all elements where * iterated over, <tt>true</tt> otherwise. */ public boolean forEach(LongProcedure procedure) { for (int i = 0; i < size;) if (!procedure.apply(get(i++))) return false; return true; }