368 |
|
} |
369 |
|
|
370 |
|
/** |
371 |
– |
* remove(x) removes x and returns true if present |
372 |
– |
*/ |
373 |
– |
public void testRemoveElement() throws InterruptedException { |
374 |
– |
LinkedTransferQueue q = populatedQueue(SIZE); |
375 |
– |
for (int i = 1; i < SIZE; i+=2) { |
376 |
– |
assertTrue(q.contains(i)); |
377 |
– |
assertTrue(q.remove(i)); |
378 |
– |
assertFalse(q.contains(i)); |
379 |
– |
assertTrue(q.contains(i-1)); |
380 |
– |
} |
381 |
– |
for (int i = 0; i < SIZE; i+=2) { |
382 |
– |
assertTrue(q.contains(i)); |
383 |
– |
assertTrue(q.remove(i)); |
384 |
– |
assertFalse(q.contains(i)); |
385 |
– |
assertFalse(q.remove(i+1)); |
386 |
– |
assertFalse(q.contains(i+1)); |
387 |
– |
} |
388 |
– |
checkEmpty(q); |
389 |
– |
} |
390 |
– |
|
391 |
– |
/** |
371 |
|
* An add following remove(x) succeeds |
372 |
|
*/ |
373 |
|
public void testRemoveElementAndAdd() throws InterruptedException { |