List of usage examples for java.util NoSuchElementException NoSuchElementException
public NoSuchElementException()
From source file:cn.cdwx.jpa.utils.PropertiesLoader.java
/** * ?BooleanProperty.Null,?true/falsefalse. *///from w w w . j av a 2 s .c o m public Boolean getBoolean(String key) { String value = getValue(key); if (value == null) { throw new NoSuchElementException(); } return Boolean.valueOf(value); }
From source file:com.kakao.network.response.ResponseBodyArray.java
private Object getOrThrow(int index) { Object v = null;/* ww w . j a va2 s . com*/ try { v = jsonArray.get(index); } catch (JSONException ignore) { } if (v == null) { throw new NoSuchElementException(); } return v; }
From source file:LinkedIterator.java
public Object next() { if (!hasNext()) { throw new NoSuchElementException(); }/*from w ww . ja va 2s . c o m*/ return ((Iterator) this.iterators.get(this.cur)).next(); }
From source file:de.schildbach.game.BoardGeometry.java
protected Iterator<Coordinate> pieceIterator(final Board board, final int color) { final Iterator<Coordinate> boardIterator = this.coordinateIterator(); return new Iterator<Coordinate>() { Coordinate next = null;/*from ww w. j a v a2 s . co m*/ public boolean hasNext() { if (next != null) { return true; } else { while (boardIterator.hasNext()) { next = boardIterator.next(); Piece piece = board.getPiece(next); if (piece != null && piece.getColor() == color) return true; } next = null; return false; } } public Coordinate next() { if (hasNext()) { Coordinate result = next; next = null; return result; } else throw new NoSuchElementException(); } public void remove() { throw new UnsupportedOperationException(); } }; }
From source file:net.orzo.lib.Files.java
public FileIterator<Object> reversedFileReader(final String path, final String encoding) throws IOException { return new FileIterator<Object>() { private ReversedLinesFileReader rlf = new ReversedLinesFileReader(new File(path), 1024 * 4, encoding); private String currLine = rlf.readLine(); @Override// www . j a va 2s . c o m public boolean hasNext() { return this.currLine != null; } @Override public Object next() { String ans; if (this.currLine != null) { ans = this.currLine; try { this.currLine = this.rlf.readLine(); } catch (IOException ex) { this.currLine = null; throw new IllegalStateException(ex); } return ans; } else { throw new NoSuchElementException(); } } @Override public void close() { try { this.currLine = null; this.rlf.close(); } catch (IOException e) { throw new IllegalStateException(e); } } @Override public String getPath() { return path; } }; }
From source file:edu.psu.chemxseer.structure.util.ArrayIterator.java
/** * Returns the next element in the array. * //from w w w . j a v a 2s. c o m * @return the next element in the array * @throws NoSuchElementException * if all the elements in the array have already been returned */ @Override public Object next() { if (hasNext() == false) { throw new NoSuchElementException(); } return Array.get(array, index++); }
From source file:hudson.model.RunMap.java
/** * Walks through builds, newer ones first. *///from w w w . j a va 2s. c o m public Iterator<R> iterator() { return new Iterator<R>() { R last = null; R next = newestBuild(); public boolean hasNext() { return next != null; } public R next() { last = next; if (last != null) next = last.getPreviousBuild(); else throw new NoSuchElementException(); return last; } public void remove() { if (last == null) throw new UnsupportedOperationException(); removeValue(last); } }; }
From source file:com.celements.iterator.XObjectIterator.java
/** * Returns the next element in the iteration. * * @return the next element in the iteration. * @exception NoSuchElementException iteration has no more elements. *///from w ww . java 2s .c o m public BaseObject next() { if (hasNext()) { BaseObject theNextObject = _nextObject; _nextObject = null; return theNextObject; } throw new NoSuchElementException(); }
From source file:$.PropertiesLoader.java
/** * ?BooleanProperty.Null,?true/falsefalse. *///from www.ja v a 2 s .c o m public Boolean getBoolean(String key) { String value = getValue(key); if (value == null) { throw new NoSuchElementException(); } return Boolean.valueOf(value); }
From source file:com.phoenixst.plexus.traversals.Walker.java
public Object next() { if (state == State.INIT) { state = State.FIRST_NODE; } else {/*w ww . j a v a2 s . c o m*/ if (nextEdge == null) { throw new NoSuchElementException(); } state = State.OTHER; currentNode = nextEdge.getOtherEndpoint(currentNode); } currentEdge = nextEdge; nextEdge = (Graph.Edge) incidentEdgeGetter.transform(currentNode); return currentNode; }