/** * Inserts a value into the set. * * @param obj an <code>Object</code> value * @return true if the set was modified by the add operation */ public boolean add(E obj) { int index = insertKey(obj); if (index < 0) { return false; // already present in set, nothing to add } postInsertHook(consumeFreeSlot); return true; // yes, we added something }
/** * Inserts a value into the set. * * @param obj an <code>Object</code> value * @return true if the set was modified by the add operation */ public boolean add(E obj) { int index = insertKey(obj); if (index < 0) { return false; // already present in set, nothing to add } postInsertHook(consumeFreeSlot); return true; // yes, we added something }
/** * Inserts a value into the set. * * @param obj an <code>Object</code> value * @return true if the set was modified by the add operation */ public boolean add(E obj) { int index = insertKey(obj); if (index < 0) { return false; // already present in set, nothing to add } postInsertHook(consumeFreeSlot); return true; // yes, we added something }
/** * Inserts a value into the set. * * @param obj an <code>Object</code> value * @return true if the set was modified by the add operation */ @Override public boolean add(E obj) { int index = insertKey(obj); if (index < 0) { return false; // already present in set, nothing to add } postInsertHook(consumeFreeSlot); return true; // yes, we added something }
/** * Inserts a value into the set. * * @param obj an <code>Object</code> value * @return true if the set was modified by the add operation */ public boolean add( E obj ) { int index = insertionIndex( obj ); if ( index < 0 ) { return false; // already present in set, nothing to add } Object old = _set[index]; _set[index] = obj; postInsertHook( old == FREE ); return true; // yes, we added something }