All pastes #405942 Raw Edit

Something

public java v1 · immutable
·published 2007-03-22 01:17 UTC
rendered paste body
    private class AdjacentVerticesIterator implements VertexIterator {        int nextPos = -1;        int vertex;                AdjacentVerticesIterator(int v)         {            vertex = v;            findNext();        }                private void findNext()         {            nextPos++;            while (nextPos < numVertices &&            		!edgeCosts.containsKey(new Edge(vertex, nextPos)))                nextPos++;        }        public boolean hasNext()         {            return nextPos < numVertices;        }                public int next()         {            int pos = nextPos;            if (pos < numVertices) {                findNext();                return pos;            }                        throw new NoSuchElementException(                "This iterator has no more elements.");        }    }