本文整理了Java中java.util.NoSuchElementException
类的一些代码示例,展示了NoSuchElementException
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NoSuchElementException
类的具体详情如下:
包路径:java.util.NoSuchElementException
类名称:NoSuchElementException
[英]Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
[中]尝试检索超过枚举或迭代器结尾的元素时引发。
代码示例来源:origin: ReactiveX/RxJava
@Override
public NoSuchElementException call() throws Exception {
return new NoSuchElementException();
}
}
代码示例来源:origin: google/guava
@Override
public T next() {
if (done) {
throw new NoSuchElementException();
}
done = true;
return value;
}
};
代码示例来源:origin: google/guava
@Override
public Range<C> range() {
throw new NoSuchElementException();
}
代码示例来源:origin: google/guava
@Override
public C first() {
throw new NoSuchElementException();
}
代码示例来源:origin: google/guava
@Override
public Range<C> range(BoundType lowerBoundType, BoundType upperBoundType) {
throw new NoSuchElementException();
}
代码示例来源:origin: google/guava
@Override
public Object next() {
throw new NoSuchElementException();
}
代码示例来源:origin: google/guava
@Override
public C last() {
throw new NoSuchElementException();
}
代码示例来源:origin: google/guava
@Override
public Range span() {
throw new NoSuchElementException();
}
代码示例来源:origin: libgdx/libgdx
public JsonValue next () {
current = entry;
if (current == null) throw new NoSuchElementException();
entry = current.next;
return current;
}
代码示例来源:origin: libgdx/libgdx
/** Returns the first (head) item in the queue (without removing it).
* @see #addFirst(Object)
* @see #removeFirst()
* @throws NoSuchElementException when queue is empty */
public T first () {
if (size == 0) {
// Underflow
throw new NoSuchElementException("Queue is empty.");
}
return values[head];
}
代码示例来源:origin: square/retrofit
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();
}
代码示例来源:origin: google/guava
/**
* Returns the url identifying the resource.
*
* <p>See {@link ClassLoader#getResource}
*
* @throws NoSuchElementException if the resource cannot be loaded through the class loader,
* despite physically existing in the class path.
*/
public final URL url() {
URL url = loader.getResource(resourceName);
if (url == null) {
throw new NoSuchElementException(resourceName);
}
return url;
}
代码示例来源:origin: google/guava
@Override
public E next() {
int index = Integer.numberOfTrailingZeros(remainingSetBits);
if (index == 32) {
throw new NoSuchElementException();
}
remainingSetBits &= ~(1 << index);
return elements.get(index);
}
};
代码示例来源:origin: spring-projects/spring-framework
@Override
public E next() {
this.inUse = true;
for (Iterator<E> iterator : this.iterators) {
if (iterator.hasNext()) {
return iterator.next();
}
}
throw new NoSuchElementException("All iterators exhausted");
}
代码示例来源:origin: google/guava
@Override
public T next() {
if (!iterator.hasNext()) {
iterator = iterable.iterator();
if (!iterator.hasNext()) {
throw new NoSuchElementException();
}
}
return iterator.next();
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onComplete() {
downstream.onError(new NoSuchElementException());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public Long next() {
long c = count;
if (c != end) {
count = c + 1;
return c;
}
throw new NoSuchElementException();
}
代码示例来源:origin: square/okhttp
@Override public Snapshot next() {
if (!hasNext()) throw new NoSuchElementException();
removeSnapshot = nextSnapshot;
nextSnapshot = null;
return removeSnapshot;
}
代码示例来源:origin: square/okhttp
@Override public String next() {
if (!hasNext()) throw new NoSuchElementException();
String result = nextUrl;
nextUrl = null;
canRemove = true;
return result;
}
代码示例来源:origin: google/guava
Object getElement() {
if (element == null) {
throw new NoSuchElementException();
} else if (extras == null) {
return element;
} else {
throw multiples(false);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!