@Override public boolean add(E e) { if (e == null) throw new NullPointerException(); boolean added = LinearProbing.add(data, e); if (added && ++size == LinearProbing.getUpperSize(data.length)) enlarge(); return added; }
@Override public boolean add(E e) { if (e == null) throw new NullPointerException(); boolean added = LinearProbing.add(data, e); if (added && ++size == LinearProbing.getUpperSize(data.length)) enlarge(); return added; }
@Override public V put(K key, V value) { if (key == null) throw new NullPointerException(); V result = putKeyValue(keys, values, key, value); if (result == null && ++size == LinearProbing.getUpperSize(keys.length)) enlarge(); return result; }
@Override public V put(K key, V value) { if (key == null) throw new NullPointerException(); V result = putKeyValue(keys, values, key, value); if (result == null && ++size == LinearProbing.getUpperSize(keys.length)) enlarge(); return result; }
@Override public V put(K key, V value) { if (key == null) throw new NullPointerException(); V result = putKeyValue(keys, values, key, value); if (result == null && ++size == LinearProbing.getUpperSize(keys.length)) enlarge(); return result; }
@Override public boolean add(E e) { if (e == null) throw new NullPointerException(); boolean added = LinearProbing.add(data, e); if (added && ++size == LinearProbing.getUpperSize(data.length)) enlarge(); return added; }
/** * Inserts a given element into the given slice * * @param s * the slice id * @param e * the elements to be inserted in to the given slice * @return {@code true} if the given element did not occur in the given * slice and thus was inserted. Otherwise {@code false} is returned * and nothing is modified. */ public boolean add(int s, E e) { if (e == null) throw new NullPointerException(); int mask = (1 << s); int oldMask = addMask(logs, data, masks, e, mask); int newMask = oldMask | mask; if (newMask == oldMask) return false; else if (oldMask == 0 && ++occupied == LinearProbing.getUpperSize(data.length)) enlarge(); sizes[s]++; return true; }
/** * Inserts a given element into the given slice * * @param s * the slice id * @param e * the elements to be inserted in to the given slice * @return {@code true} if the given element did not occur in the given * slice and thus was inserted. Otherwise {@code false} is returned * and nothing is modified. */ public boolean add(int s, E e) { if (e == null) throw new NullPointerException(); int mask = (1 << s); int oldMask = addMask(logs, data, masks, e, mask); int newMask = oldMask | mask; if (newMask == oldMask) return false; else if (oldMask == 0 && ++occupied == LinearProbing.getUpperSize(data.length)) enlarge(); sizes[s]++; return true; }
/** * Inserts a given element into the given slice * * @param s * the slice id * @param e * the elements to be inserted in to the given slice * @return {@code true} if the given element did not occur in the given * slice and thus was inserted. Otherwise {@code false} is returned * and nothing is modified. */ public boolean add(int s, E e) { if (e == null) throw new NullPointerException(); int mask = (1 << s); int oldMask = addMask(logs, data, masks, e, mask); int newMask = oldMask | mask; if (newMask == oldMask) return false; else if (oldMask == 0 && ++occupied == LinearProbing.getUpperSize(data.length)) enlarge(); sizes[s]++; return true; }