Returns a collection view of the values contained in this map. The collection's iterator will return the values in the order that their corresponding keys appear in the tree. The collection is backed by this RBTreeMap instance, so changes to this map are reflected in the collection, and v
()
| 601 | * @return a collection view of the values contained in this map. |
| 602 | */ |
| 603 | @Override |
| 604 | public Collection<V> values() { |
| 605 | if (values == null) { |
| 606 | values = new AbstractCollection<V>() { |
| 607 | @Override |
| 608 | public java.util.Iterator<V> iterator() { |
| 609 | return new Iterator<V>(VALUES); |
| 610 | } |
| 611 | |
| 612 | @Override |
| 613 | public int size() { |
| 614 | return RBTreeMap.this.size(); |
| 615 | } |
| 616 | |
| 617 | @Override |
| 618 | public boolean contains(Object o) { |
| 619 | for (Entry<K,V> e = firstEntry(); e != null; e = successor(e)) |
| 620 | if (valEquals(e.getValue(), o)) |
| 621 | return true; |
| 622 | return false; |
| 623 | } |
| 624 | |
| 625 | @Override |
| 626 | public boolean remove(Object o) { |
| 627 | for (Entry<K,V> e = firstEntry(); e != null; e = successor(e)) { |
| 628 | if (valEquals(e.getValue(), o)) { |
| 629 | deleteEntry(e); |
| 630 | return true; |
| 631 | } |
| 632 | } |
| 633 | return false; |
| 634 | } |
| 635 | |
| 636 | @Override |
| 637 | public void clear() { |
| 638 | RBTreeMap.this.clear(); |
| 639 | } |
| 640 | }; |
| 641 | } |
| 642 | return values; |
| 643 | } |
| 644 | |
| 645 | /** |
| 646 | * Returns a set view of the mappings contained in this map. The set's |
no outgoing calls