Example usage for java.util NoSuchElementException NoSuchElementException

List of usage examples for java.util NoSuchElementException NoSuchElementException

Introduction

In this page you can find the example usage for java.util NoSuchElementException NoSuchElementException.

Prototype

public NoSuchElementException() 

Source Link

Document

Constructs a NoSuchElementException with null as its error message string.

Usage

From source file:com.cloudera.oryx.common.collection.SamplingLongPrimitiveIterator.java

@Override
public long nextLong() {
    if (hasNext) {
        long result = next;
        doNext();// www.  j av a 2  s  .  c o  m
        return result;
    }
    throw new NoSuchElementException();
}

From source file:com.bmd.android.collection.internal.SparseArrayCompatIterator.java

@Override
protected SparseArrayEntry<V> getElementAt(final int position) {

    try {//from   ww w .  ja v a  2 s  .com

        mValue = mSparseArray.valueAt(position);

    } catch (final IndexOutOfBoundsException e) {

        throw new NoSuchElementException();
    }

    mPosition = position;

    return this;
}

From source file:com.bmd.android.collection.internal.SupportLongSparseArrayIterator.java

@Override
protected LongSparseArrayEntry<V> getElementAt(final int position) {

    try {//from   w  w w  . j a  v a2s.  com

        mValue = mSparseArray.valueAt(position);

    } catch (final IndexOutOfBoundsException e) {

        throw new NoSuchElementException();
    }

    mPosition = position;

    return this;
}

From source file:com.bmd.android.collection.internal.SimpleArrayMapIterator.java

@Override
protected SimpleArrayMapEntry<K, V> getElementAt(final int position) {

    try {//from   w ww .ja  va2 s . co  m

        mValue = mArrayMap.valueAt(position);

    } catch (final IndexOutOfBoundsException e) {

        throw new NoSuchElementException();
    }

    mPosition = position;

    return this;
}

From source file:SparseArrayIterator.java

/**
 * Get next iteration element./*from  w w w. j  a  v a  2 s  .  co  m*/
 *
 * @return next iteration element
 * @exception NoSuchElementException if past end of iteration
 */
public Object next() {
    if (m_offset < m_array.length) {
        Object result = m_array[m_offset];
        advance();
        return result;
    } else {
        throw new NoSuchElementException();
    }
}

From source file:org.squashtest.tm.plugin.testautomation.jenkins.internal.FetchTestListStepSequence.java

@Override
public BuildStep<?> nextElement() {
    switch (currentStage) {

    case WAITING:
        currentStage = BuildStage.START_BUILD;
        return newStartBuild();

    case START_BUILD:
        currentStage = BuildStage.CHECK_QUEUE;
        return newCheckQueue();

    case CHECK_QUEUE:
        currentStage = BuildStage.GET_BUILD_ID;
        return newGetBuildID();

    case GET_BUILD_ID:
        currentStage = BuildStage.CHECK_BUILD_RUNNING;
        return newCheckBuildRunning();

    case CHECK_BUILD_RUNNING:
        currentStage = BuildStage.GATHER_RESULT;
        return newGatherTestList();

    case GATHER_RESULT:
        throw new NoSuchElementException();

    default://from w  w  w  .jav a  2s  .c om
        throw new NoSuchElementException();

    }
}

From source file:com.phoenixst.plexus.traversals.TopologicalSortTraverser.java

public Object next() {
    if (t == null || !t.hasNext()) {
        if (!nodeIter.hasNext()) {
            throw new NoSuchElementException();
        }//www . ja  v  a2 s.  c om
        t = new DepthFirstTraverser(nodeIter.next(), traverserFactory);
    }
    Object node = t.next();
    while (t.isDescending()) {
        if (!nodeSet.add(node)) {
            t.prune();
        }
        node = t.next();
    }
    return node;
}

From source file:ArrayIterator.java

/**
 * Returns the next element in the array.
 *
 * @return the next element in the array
 * @throws NoSuchElementException if all the elements in the array
 *  have already been returned//from  w  w  w.  j a  va2  s  . co  m
 */
public Object next() {
    if (hasNext() == false) {
        throw new NoSuchElementException();
    }
    return Array.get(array, index++);
}

From source file:com.phoenixst.plexus.util.FilteredTraverser.java

public Object next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }//from  ww w.  ja va  2  s .c  o  m
    currentNode = nextNode;
    currentEdge = nextEdge;
    isCurrentValid = true;
    isNextValid = false;
    return currentNode;
}

From source file:com.addthis.bundle.core.list.ListBundle.java

@Override
public Iterator<BundleField> iterator() {
    return new Iterator<BundleField>() {
        private final Iterator<BundleField> iter = format.iterator();
        private BundleField peek = null;
        private BundleField prev = null;

        @Override//from w  ww  . j a  va2  s. c  o  m
        public boolean hasNext() {
            while (peek == null && iter.hasNext()) {
                BundleField next = iter.next();
                ValueObject value = getRawValue(next);
                if (value == SKIP) {
                    continue;
                }
                peek = next;
                break;
            }
            return peek != null;
        }

        @Override
        public BundleField next() {
            if (hasNext()) {
                BundleField next = peek;
                prev = next;
                peek = null;
                return next;
            }
            throw new NoSuchElementException();
        }

        @Override
        public void remove() {
            checkState(prev != null, "Next has not yet been called or remove already has");
            removeValue(prev);
            prev = null;
        }
    };
}