Examples of LongListIterator


Examples of it.unimi.dsi.fastutil.longs.LongListIterator

  /**
   * Returns a {@link StreamDataFileIndexIterator} for iterating over all (timestamp, position) pairs.
   */
  StreamDataFileIndexIterator indexIterator() {
    final LongListIterator timestampIter = timestamps.iterator();
    final LongListIterator positionIter = positions.iterator();

    return new StreamDataFileIndexIterator() {

      private long timestamp;
      private long position;

      @Override
      public boolean nextIndexEntry() {
        if (timestampIter.hasNext() && positionIter.hasNext()) {
          timestamp = timestampIter.nextLong();
          position = positionIter.nextLong();
          return true;
        }
        return false;
      }

View Full Code Here

Examples of org.apache.commons.collections.primitives.LongListIterator

    // tests
    // ------------------------------------------------------------------------

    public final void testLongListIteratorNotModifiable() {
        LongListIterator iter = makeUnmodifiableLongListIterator();
        assertTrue(iter.hasNext());
        iter.next();
        try {
            iter.remove();
            fail("Expected UnsupportedOperationException");
        } catch(UnsupportedOperationException e) {
            // expected
        }
        try {
            iter.add(1);
            fail("Expected UnsupportedOperationException");
        } catch(UnsupportedOperationException e) {
            // expected
        }
        try {
            iter.set(3);
            fail("Expected UnsupportedOperationException");
        } catch(UnsupportedOperationException e) {
            // expected
        }
    }
View Full Code Here

Examples of org.apache.commons.collections.primitives.LongListIterator

            // expected
        }
    }

    public final void testIterateLongListIterator() {       
        LongListIterator iter = makeUnmodifiableLongListIterator();
        LongListIterator expected = makeLongListIterator();
       
        assertTrue(! iter.hasPrevious());
       
        while( expected.hasNext() ) {
            assertTrue(iter.hasNext());
            assertEquals(expected.nextIndex(),iter.nextIndex());
            assertEquals(expected.previousIndex(),iter.previousIndex());
            assertEquals(expected.next(),iter.next());
            assertTrue(iter.hasPrevious());
            assertEquals(expected.nextIndex(),iter.nextIndex());
            assertEquals(expected.previousIndex(),iter.previousIndex());
        }

        assertTrue(! iter.hasNext() );

        while( expected.hasPrevious() ) {
            assertTrue(iter.hasPrevious());
            assertEquals(expected.nextIndex(),iter.nextIndex());
            assertEquals(expected.previousIndex(),iter.previousIndex());
            assertEquals(expected.previous(),iter.previous());
            assertTrue(iter.hasNext());
            assertEquals(expected.nextIndex(),iter.nextIndex());
            assertEquals(expected.previousIndex(),iter.previousIndex());
        }
        assertTrue(! iter.hasPrevious() );
    }
View Full Code Here

Examples of org.apache.commons.collections.primitives.LongListIterator

    public void testWrapNull() {
        assertNull(UnmodifiableLongListIterator.wrap(null));
    }

    public void testWrapUnmodifiableLongListIterator() {
        LongListIterator iter = makeUnmodifiableLongListIterator();
        assertSame(iter,UnmodifiableLongListIterator.wrap(iter));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.