@Override public NoSuchElementException call() throws Exception { return new NoSuchElementException(); } }
private static int indexOf(Object[] array, Object toFind) { for (int i = 0; i < array.length; i++) { if (toFind.equals(array[i])) return i; } throw new NoSuchElementException(); }
@Override public E next() { int index = Integer.numberOfTrailingZeros(remainingSetBits); if (index == 32) { throw new NoSuchElementException(); } remainingSetBits &= ~(1 << index); return elements.get(index); } };
@Override public T next() { if (!iterator.hasNext()) { iterator = iterable.iterator(); if (!iterator.hasNext()) { throw new NoSuchElementException(); } } return iterator.next(); }
@Override public void onComplete() { downstream.onError(new NoSuchElementException()); } }
@Override public Long next() { long c = count; if (c != end) { count = c + 1; return c; } throw new NoSuchElementException(); }
@Override public Snapshot next() { if (!hasNext()) throw new NoSuchElementException(); removeSnapshot = nextSnapshot; nextSnapshot = null; return removeSnapshot; }
@Override public String next() { if (!hasNext()) throw new NoSuchElementException(); String result = nextUrl; nextUrl = null; canRemove = true; return result; }
Object getElement() { if (element == null) { throw new NoSuchElementException(); } else if (extras == null) { return element; } else { throw multiples(false); } } }
@Override public Entry<K, V> next() { if (!hasNext()) { throw new NoSuchElementException(); } ValueEntry<K, V> result = nextEntry; toRemove = result; nextEntry = nextEntry.successorInMultimap; return result; }
@Override public E first() { if (isEmpty()) { throw new NoSuchElementException(); } return elements.get(0); }
@Override public T next() { if (!hasNext()) { throw new NoSuchElementException(); } count++; return iterator.next(); }
@Override public T next() { if (hasNext()) { toRemove = iterator; return iterator.next(); } else { throw new NoSuchElementException(); } }
/** * @return TreeNode next. The next element according to our in-order traversal of the given BST * @throws NoSuchElementException if this iterator does not have a next element */ @Override public TreeNode<T> next() throws NoSuchElementException { if (pathStack.isEmpty()) { throw new NoSuchElementException(); } TreeNode<T> next = pathStack.pop(); pushPathToNextSmallest(next.getRight()); return next; }
@Override public void onComplete() { upstream = DisposableHelper.DISPOSED; if (defaultValue != null) { downstream.onSuccess(defaultValue); } else { downstream.onError(new NoSuchElementException("The MaybeSource is empty")); } } }
@Override public T next() { if (hasNext()) { T v = iteratorNotification.getValue(); iteratorNotification = null; return v; } throw new NoSuchElementException(); }
@Override public T next() { if (hasNext()) { return queue.poll(); } throw new NoSuchElementException(); }
@Override public void onComplete() { upstream = SubscriptionHelper.CANCELLED; if (!done) { done = true; T v = defaultValue; if (v != null) { downstream.onSuccess(v); } else { downstream.onError(new NoSuchElementException()); } } }
@Override public T next() { if (hasNext()) { if (iteratorNotification.isOnNext()) { T v = iteratorNotification.getValue(); iteratorNotification = null; return v; } } throw new NoSuchElementException(); }
/** * Removes and returns the greatest element of this queue. * * @throws NoSuchElementException if the queue is empty */ @CanIgnoreReturnValue public E removeLast() { if (isEmpty()) { throw new NoSuchElementException(); } return removeAndGet(getMaxElementIndex()); }