463 |
|
|
464 |
|
} |
465 |
|
|
466 |
+ |
/** |
467 |
+ |
* lowerEntry, higherEntry, ceilingEntry, and floorEntry return |
468 |
+ |
* imutable entries |
469 |
+ |
*/ |
470 |
+ |
public void testEntryImmutablity() { |
471 |
+ |
ConcurrentSkipListMap map = map5(); |
472 |
+ |
Map.Entry e = map.lowerEntry(three); |
473 |
+ |
assertEquals(two, e.getKey()); |
474 |
+ |
try { |
475 |
+ |
e.setValue("X"); |
476 |
+ |
fail(); |
477 |
+ |
} catch(UnsupportedOperationException success) {} |
478 |
+ |
e = map.higherEntry(zero); |
479 |
+ |
assertEquals(one, e.getKey()); |
480 |
+ |
try { |
481 |
+ |
e.setValue("X"); |
482 |
+ |
fail(); |
483 |
+ |
} catch(UnsupportedOperationException success) {} |
484 |
+ |
e = map.floorEntry(one); |
485 |
+ |
assertEquals(one, e.getKey()); |
486 |
+ |
try { |
487 |
+ |
e.setValue("X"); |
488 |
+ |
fail(); |
489 |
+ |
} catch(UnsupportedOperationException success) {} |
490 |
+ |
e = map.ceilingEntry(five); |
491 |
+ |
assertEquals(five, e.getKey()); |
492 |
+ |
try { |
493 |
+ |
e.setValue("X"); |
494 |
+ |
fail(); |
495 |
+ |
} catch(UnsupportedOperationException success) {} |
496 |
+ |
} |
497 |
+ |
|
498 |
+ |
|
499 |
|
|
500 |
|
/** |
501 |
|
* lowerKey returns preceding element |