|
18 | 18 | use container::{Container, Mutable, Map, Set};
|
19 | 19 | use cmp::{Eq, Equiv};
|
20 | 20 | use hash::Hash;
|
21 |
| -use old_iter::BaseIter; |
22 | 21 | use iterator::{Iterator, IteratorUtil};
|
23 | 22 | use option::{None, Option, Some};
|
24 | 23 | use rand::RngUtil;
|
@@ -622,12 +621,6 @@ pub struct HashSet<T> {
|
622 | 621 | priv map: HashMap<T, ()>
|
623 | 622 | }
|
624 | 623 |
|
625 |
| -impl<T:Hash + Eq> BaseIter<T> for HashSet<T> { |
626 |
| - /// Visit all values in order |
627 |
| - fn each(&self, f: &fn(&T) -> bool) -> bool { self.map.each_key(f) } |
628 |
| - fn size_hint(&self) -> Option<uint> { Some(self.len()) } |
629 |
| -} |
630 |
| - |
631 | 624 | impl<T:Hash + Eq> Eq for HashSet<T> {
|
632 | 625 | fn eq(&self, other: &HashSet<T>) -> bool { self.map == other.map }
|
633 | 626 | fn ne(&self, other: &HashSet<T>) -> bool { self.map != other.map }
|
@@ -725,6 +718,12 @@ impl<T:Hash + Eq> HashSet<T> {
|
725 | 718 | self.map.contains_key_equiv(value)
|
726 | 719 | }
|
727 | 720 |
|
| 721 | + /// Visit all elements in arbitrary order |
| 722 | + /// FIXME: Remove when all callers are converted |
| 723 | + pub fn each(&self, f: &fn(&T) -> bool) -> bool { |
| 724 | + self.iter().advance(f) |
| 725 | + } |
| 726 | + |
728 | 727 | /// An iterator visiting all elements in arbitrary order.
|
729 | 728 | /// Iterator element type is &'a T.
|
730 | 729 | pub fn iter<'a>(&'a self) -> HashSetIterator<'a, T> {
|
|
0 commit comments