1 |
|
/* |
2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
< |
* http://creativecommons.org/licenses/publicdomain |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
|
7 |
|
import junit.framework.*; |
276 |
|
public void testRemoveElement() { |
277 |
|
ConcurrentSkipListSet q = populatedSet(SIZE); |
278 |
|
for (int i = 1; i < SIZE; i+=2) { |
279 |
< |
assertTrue(q.remove(new Integer(i))); |
279 |
> |
assertTrue(q.contains(i)); |
280 |
> |
assertTrue(q.remove(i)); |
281 |
> |
assertFalse(q.contains(i)); |
282 |
> |
assertTrue(q.contains(i-1)); |
283 |
|
} |
284 |
|
for (int i = 0; i < SIZE; i+=2) { |
285 |
< |
assertTrue(q.remove(new Integer(i))); |
286 |
< |
assertFalse(q.remove(new Integer(i+1))); |
285 |
> |
assertTrue(q.contains(i)); |
286 |
> |
assertTrue(q.remove(i)); |
287 |
> |
assertFalse(q.contains(i)); |
288 |
> |
assertFalse(q.remove(i+1)); |
289 |
> |
assertFalse(q.contains(i+1)); |
290 |
|
} |
291 |
|
assertTrue(q.isEmpty()); |
292 |
|
} |