@Test public void testIterator() { int count = TestData.getScaleCount(); Set<Revision<L, K, V>> revisions = Sets .newHashSetWithExpectedSize(count); for (int i = 0; i < count; ++i) { Revision<L, K, V> revision = null; while (revision == null || revisions.contains(revision)) { L locator = getLocator(); K key = getKey(); V value = getValue(); long version = Time.now(); Action type = Action.ADD; revision = chunk.makeRevision(locator, key, value, version, type); } chunk.insert(revision.getLocator(), revision.getKey(), revision.getValue(), revision.getVersion(), revision.getType()); revisions.add(revision); } Folio folio = chunk.serialize(); FileSystem.writeBytes(folio.bytes(), file.toString()); chunk.freeze(file); chunk = load(file, filter, folio.manifest()); Iterator<Revision<L, K, V>> it = chunk.iterator(); Set<Revision<L, K, V>> stored = Sets.newHashSetWithExpectedSize(count); while (it.hasNext()) { stored.add(it.next()); } Assert.assertEquals(revisions, stored); }
@Override public Iterator<Revision<L, K, V>> iterator() { return revisions().iterator(); }
Chunk implements
        Byteable,
        Freezable,
        Iterable<Revision<L, K, V>>,
        Itemizable { @Override public Iterator<Revision<L, K, V>> iterator() { return revisions().iterator(); } }
Chunk implements
        Byteable,
        Freezable,
        Iterable<Revision<L, K, V>>,
        Itemizable { @Override public Iterator<Revision<L, K, V>> iterator() { return revisions().iterator(); } protected  Chunk(@Nullable Segment segment, BloomFilter filter); protected  Chunk(@Nullable Segment segment, Path file, long position,
            long size, BloomFilter filter, Manifest manifest); }
Chunk implements
        Byteable,
        Freezable,
        Iterable<Revision<L, K, V>>,
        Itemizable { @Override public Iterator<Revision<L, K, V>> iterator() { return revisions().iterator(); } protected  Chunk(@Nullable Segment segment, BloomFilter filter); protected  Chunk(@Nullable Segment segment, Path file, long position,
            long size, BloomFilter filter, Manifest manifest); @Override void copyTo(ByteSink sink); @Override long count(); String dump(); @Override boolean equals(Object obj); void freeze(Path file, long position); @Override int hashCode(); Revision<L, K, V> insert(L locator, K key, V value, long version,
            Action type); @Override boolean isFrozen(); @Override Iterator<Revision<L, K, V>> iterator(); boolean mightContain(Composite composite); final void seek(Composite composite, Record<L, K, V> record); Folio serialize(); @Override int size(); String id(); @Override String toString(); }
Chunk implements
        Byteable,
        Freezable,
        Iterable<Revision<L, K, V>>,
        Itemizable { @Override public Iterator<Revision<L, K, V>> iterator() { return revisions().iterator(); } protected  Chunk(@Nullable Segment segment, BloomFilter filter); protected  Chunk(@Nullable Segment segment, Path file, long position,
            long size, BloomFilter filter, Manifest manifest); @Override void copyTo(ByteSink sink); @Override long count(); String dump(); @Override boolean equals(Object obj); void freeze(Path file, long position); @Override int hashCode(); Revision<L, K, V> insert(L locator, K key, V value, long version,
            Action type); @Override boolean isFrozen(); @Override Iterator<Revision<L, K, V>> iterator(); boolean mightContain(Composite composite); final void seek(Composite composite, Record<L, K, V> record); Folio serialize(); @Override int size(); String id(); @Override String toString();  }