/** * Removes the given object from the given slice * * @param s * the slice id * @param o * the object that should be removed from the given slice * @return {@code true} if the given object is equal to some element of the * given slice; this element will be removed from the slice. If * there is no such an object, {@code false} is returned and nothing * is modified */ public boolean remove(int s, Object o) { if (o == null) throw new NullPointerException(); int mask = 1 << s; int oldMask = removeMask(logs, data, masks, o, mask); int newMask = oldMask & ~mask; if (newMask == oldMask) return false; // else if (newMask == 0 && --occupied == LinearProbing.getLowerSize(data.length)) shrink(); sizes[s]--; return true; }
/** * Removes the given object from the given slice * * @param s * the slice id * @param o * the object that should be removed from the given slice * @return {@code true} if the given object is equal to some element of the * given slice; this element will be removed from the slice. If * there is no such an object, {@code false} is returned and nothing * is modified */ public boolean remove(int s, Object o) { if (o == null) throw new NullPointerException(); int mask = 1 << s; int oldMask = removeMask(logs, data, masks, o, mask); int newMask = oldMask & ~mask; if (newMask == oldMask) return false; // else if (newMask == 0 && --occupied == LinearProbing.getLowerSize(data.length)) shrink(); sizes[s]--; return true; }
/** * Removes the given object from the given slice * * @param s * the slice id * @param o * the object that should be removed from the given slice * @return {@code true} if the given object is equal to some element of the * given slice; this element will be removed from the slice. If * there is no such an object, {@code false} is returned and nothing * is modified */ public boolean remove(int s, Object o) { if (o == null) throw new NullPointerException(); int mask = 1 << s; int oldMask = removeMask(logs, data, masks, o, mask); int newMask = oldMask & ~mask; if (newMask == oldMask) return false; // else if (newMask == 0 && --occupied == LinearProbing.getLowerSize(data.length)) shrink(); sizes[s]--; return true; }