public final V putOrAggregate(K key, V value, ReduceFunction<V> aggregator) throws Exception {
		final int hash = hash(key);
		final int slot = indexOf(hash);

		// search the chain from the slot
		for (Entry<K, V> entry = table[slot]; entry != null; entry = entry.next) {
			if (entry.hashCode == hash && entry.key.equals(key)) {
				// found match
				entry.value = aggregator.reduce(entry.value, value);
				return entry.value;
			}
		}

		// no match, insert a new value
		insertNewEntry(hash, key, value, slot);
		// return the original value
		return value;
	}
public final V putOrAggregate ( K key , V value , ReduceFunction < V > aggregator ) throws Exception { final int hash = hash ( key ) ; final int slot = indexOf ( hash ) ; for ( Entry < K , V > entry = table [ slot ] ; entry != null ; entry = entry . next ) { if ( entry . hashCode == hash && entry . key . equals ( key ) ) { entry . value = aggregator . reduce ( entry . value , value ) ; return entry . value ; } } insertNewEntry ( hash , key , value , slot ) ; return value ; }
Inserts or aggregates a value into the hash map. If the hash map does not yet contain the key,
this method inserts the value. If the table already contains the key (and a value) this
method will use the given ReduceFunction function to combine the existing value and the
given value to a new value, and store that value for the key.

@param key The key to map the value.
@param value The new value to insert, or aggregate with the existing value.
@param aggregator The aggregator to use if a value is already contained.

@return The value in the map after this operation: Either the given value, or the aggregated value.

@throws java.lang.NullPointerException Thrown, if the key is null.
@throws Exception The method forwards exceptions from the aggregation function.