/** * Remove {@code o} from the set. This is the uppercase {@link Integer} * version of remove, requires a type-check and auto-unboxing. When * possible use the {@code int} version of {@link #remove(int)} for * efficiency. * @return <tt>true</tt> if i was removed to the set. */ public boolean remove( final Object o ) { return o instanceof Integer && remove(((Integer) o).intValue()); }
void work_helper(NonBlockingSetInt nbsi, String thrd, int d) { final int ITERS = 100000; for (int j = 0; j < 10; j++) { //long start = System.nanoTime(); for (int i = d; i < ITERS; i += 2) { nbsi.add(i); } for (int i = d; i < ITERS; i += 2) { nbsi.remove(i); } //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="+nbsi.size()); } } }
prim.remove(k);
assertFalse(_nbsi.add(2)); checkSizes(2); assertThat(_nbsi.remove(1), is(true)); checkSizes(1); assertThat(_nbsi.remove(1), is(false)); assertTrue(_nbsi.remove(2)); checkSizes(0); assertFalse(_nbsi.remove(2)); assertFalse(_nbsi.remove(3)); assertTrue(_nbsi.isEmpty()); assertTrue(_nbsi.add(63)); checkSizes(1); assertTrue(_nbsi.remove(63)); assertFalse(_nbsi.remove(63)); assertFalse(_nbsi.add(20000)); checkSizes(2); assertThat(_nbsi.remove(10000), is(true)); checkSizes(1); assertThat(_nbsi.remove(10000), is(false)); assertTrue(_nbsi.remove(20000)); checkSizes(0); assertFalse(_nbsi.remove(20000)); _nbsi.clear();
/** * Remove {@code o} from the set. This is the uppercase {@link Integer} * version of remove, requires a type-check and auto-unboxing. When * possible use the {@code int} version of {@link #remove(int)} for * efficiency. * @return <tt>true</tt> if i was removed to the set. */ public boolean remove( final Object o ) { return o instanceof Integer && remove(((Integer) o).intValue()); }