Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  *  Copyright 2009-2014 Pavel Ponec
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
  *  You may obtain a copy of the License at
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
package org.ujorm.core;
Ujo iterator have got some extended functions:
  • iterator can provide optionally a count of items by a count() method
  • iterator can be used in generic loop syntax for( : )
  • iterator can create a List object

Pavel Ponec
class UjoIteratorImpl<T> extends UjoIterator<T> {
    final private Iterator<T> e;
    final private long count;
    public UjoIteratorImpl(final Iterator<T> iteratorlong count) {
        this. = iterator;
        this. = count;
    public UjoIteratorImpl(final Iterator<T> iterator) {
        this(iterator, -1);

Tests if this enumeration contains more elements.
    public boolean hasNext() {
        return .hasNext();

Returns the next element if exists.

the next element
java.util.NoSuchElementException no more elements exist.
    public T next() throws NoSuchElementException {
        return .next();

Returns a count of items or value -1 if the count is not defined.
    public long count() {
        return ;
New to GrepCode? Check out our FAQ X