Guava PeekingIterator - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava PeekingIterator class.

This code example shows how to use the following methods:hasNext
        final PeekingIterator<T> it = Iterators.peekingIterator(iterator);
        return new UnmodifiableIterator<T>() {
 
            @Override 
            public boolean hasNext() { 
                return it.hasNext();
            } 
 
            @Override 
            public T next() { 
                final T ret = it.next();
                while (it.hasNext() && comparator.compare(ret, it.peek()) == 0) {
                    it.next();
                } 
                assert !it.hasNext() || comparator.compare(ret, it.peek()) < 0 : "iterator is not sorted: " + ret + " > " + it.peek();
                return ret;
            } 
 
        }; 
    } 
6
CodeRank
This code example shows how to use the following methods:next
		return iterator.hasNext();
	} 
 
	@Override 
	public Row<K, N, V> next() { 
		Row<K, N, V> row = iterator.next();
		startKey = row.getKey();
		rows++;
 
		return row;
	} 
 
	@Override 
	public void remove() { 
		iterator.remove();
	} 
 
	public RangeSlicesIterator<K, N, V> setFilter(SliceFilter<Row<K, N, V>> filter) {
		this.filter = filter;
 
5
CodeRank
This code example shows how to use the following methods:next
        } 
 
        @Override 
        public InternalEntry next() 
        { 
            Entry<InternalKey, Slice> entry = iterator.next();
            return new InternalEntry(entry.getKey(), entry.getValue());
        } 
 
        @Override 
        public void remove() 
        { 
            throw new UnsupportedOperationException();
        } 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:next
      return iterator.hasNext();
    } 
 
    @Override 
    public DomainEventMessage next() { 
      return iterator.next();
    } 
 
    @Override 
    public DomainEventMessage peek() { 
      return iterator.peek();
    } 
  } 
} 
4
CodeRank
See Code Examples for Guava PeekingIterator Methods: