Returns a Set view of the keys contained in this map. The set's iterator will return the keys in ascending order. The map is backed by this RBTreeMap instance, so changes to this map are reflected in the Set, and vice-versa. The Set supports element removal, which removes the correspondi
()
| 554 | * @return a set view of the keys contained in this RBTreeMap. |
| 555 | */ |
| 556 | @Override |
| 557 | public Set<K> keySet() { |
| 558 | if (keySet == null) { |
| 559 | keySet = new AbstractSet<K>() { |
| 560 | |
| 561 | @Override |
| 562 | public java.util.Iterator<K> iterator() { |
| 563 | return new Iterator<K>(KEYS); |
| 564 | } |
| 565 | |
| 566 | @Override |
| 567 | public int size() { |
| 568 | return RBTreeMap.this.size(); |
| 569 | } |
| 570 | |
| 571 | @Override |
| 572 | public boolean contains(Object o) { |
| 573 | return containsKey(o); |
| 574 | } |
| 575 | |
| 576 | @Override |
| 577 | public boolean remove(Object o) { |
| 578 | return RBTreeMap.this.remove(o) != null; |
| 579 | } |
| 580 | |
| 581 | @Override |
| 582 | public void clear() { |
| 583 | RBTreeMap.this.clear(); |
| 584 | } |
| 585 | }; |
| 586 | } |
| 587 | return keySet; |
| 588 | } |
| 589 | |
| 590 | /** |
| 591 | * Returns a collection view of the values contained in this map. The |
no outgoing calls