public boolean remove ( Object k ) { return NonBlockingHashMapLong.this.remove (k) != null; } public IteratorLong iterator() { return new IteratorLong(); }
/** Auto-boxing version of {@link #remove(long)}. */ public TypeV remove ( Object key ) { return (key instanceof Long) ? remove (((Long)key).longValue()) : null; } /** Auto-boxing version of {@link #remove(long,Object)}. */
/** Auto-boxing version of {@link #remove(long,Object)}. */ public boolean remove ( Object key, Object Val ) { return (key instanceof Long) && remove(((Long) key).longValue(), Val); } /** Auto-boxing version of {@link #containsKey(long)}. */
_hash.remove(k2); del_ops++;
_hash.remove(k);
void work_helper(NonBlockingHashMapLong<String> nbhml, int d, int num_thrds) { String thrd = "T" + d; final int ITERS = 20000; for (int j = 0; j < 10; j++) { //long start = System.nanoTime(); for (int i = d; i < ITERS; i += num_thrds) { assertThat("key " + i + " not in there, so putIfAbsent must work", nbhml.putIfAbsent((long) i, thrd), is((String) null)); } for (int i = d; i < ITERS; i += num_thrds) { assertTrue(nbhml.remove((long) i, thrd)); } //double delta_nanos = System.nanoTime()-start; //double delta_secs = delta_nanos/1000000000.0; //double ops = ITERS*2; //System.out.println("Thrd"+thrd+" "+(ops/delta_secs)+" ops/sec size="+nbhml.size()); } }
checkSizes(2); assertThat(_nbhml.putIfAbsent(2, "v2b"), is("v2a")); assertThat(_nbhml.remove(1), is("v1a")); assertFalse(_nbhml.containsKey(1)); checkSizes(1); assertThat(_nbhml.remove(1), nullValue()); assertThat(_nbhml.remove(2), is("v2a")); checkSizes(0); assertThat(_nbhml.remove(2), nullValue()); assertThat(_nbhml.remove("k3"), nullValue()); assertTrue(_nbhml.isEmpty()); assertTrue(_nbhml.containsKey(0)); checkSizes(1); assertThat(_nbhml.remove(0), is("v0")); assertFalse(_nbhml.containsKey(0)); checkSizes(0); assertEquals(_nbhml.replace(0, "v0a"), "v0"); assertEquals(_nbhml.get(0), "v0a"); assertThat(_nbhml.remove(0), is("v0a")); assertFalse(_nbhml.containsKey(0)); checkSizes(0); assertEquals(_nbhml.replace(1, "v1a"), "v1"); assertEquals(_nbhml.get(1), "v1a"); assertThat(_nbhml.remove(1), is("v1a")); assertFalse(_nbhml.containsKey(1)); checkSizes(0);
public boolean remove ( Object k ) { return NonBlockingHashMapLong.this.remove (k) != null; } public IteratorLong iterator() { return new IteratorLong(); }
/** Auto-boxing version of {@link #remove(long,Object)}. */ public boolean remove ( Object key, Object Val ) { return (key instanceof Long) && remove(((Long) key).longValue(), Val); } /** Auto-boxing version of {@link #containsKey(long)}. */
/** Auto-boxing version of {@link #remove(long)}. */ public TypeV remove ( Object key ) { return (key instanceof Long) ? remove (((Long)key).longValue()) : null; } /** Auto-boxing version of {@link #remove(long,Object)}. */