List of usage examples for java.util NoSuchElementException NoSuchElementException
public NoSuchElementException()
From source file:BreadthFirstFileTreeIterator.java
/** Returns the next element in the iteration. //ww w .ja v a 2 s. co m @return The next element in the iteration */ public Object next() { if (endOfTree) throw new NoSuchElementException(); File file = getNextFile(); if (file == null) { throw new NoSuchElementException(); } this.nextFile = null; return file; }
From source file:Main.java
private static <E> E getSmallestNotNull(final Comparator<? super E> comparator, final List<? extends E> randomAccessList) { E result = randomAccessList.get(0);/*from w w w . j a va 2 s. c o m*/ E element; for (int i = 1; i < randomAccessList.size(); i++) { element = randomAccessList.get(i); if (element == null) { continue; } if ((result == null) || (comparator.compare(element, result) < 0)) { result = element; } } if (result == null) { throw new NoSuchElementException(); } return result; }
From source file:Main.java
private static <E> E getGreatestNotNull(final Comparator<? super E> comparator, final List<? extends E> randomAccessList) { E result = randomAccessList.get(0);//from w w w .ja v a 2 s .c o m E element; for (int i = 1; i < randomAccessList.size(); i++) { element = randomAccessList.get(i); if (element == null) { continue; } if ((result == null) || (comparator.compare(element, result) > 0)) { result = element; } } if (result == null) { throw new NoSuchElementException(); } return result; }
From source file:ddf.catalog.transformer.csv.common.MetacardIterator.java
/** {@inheritDoc} */ @Override//from w w w . j a v a 2 s.co m public Serializable next() { if (!this.hasNext()) { throw new NoSuchElementException(); } AttributeDescriptor attributeDescriptor = this.attributeDescriptorList.get(index); Attribute attribute = metacard.getAttribute(attributeDescriptor.getName()); index++; if (attribute != null) { if (attributeDescriptor.isMultiValued()) { return StringUtils.join(attribute.getValues(), MULTIVALUE_DELIMITER); } else { return attribute.getValue(); } } return ""; }
From source file:com.predic8.membrane.core.interceptor.authentication.session.UnifyingUserDataProvider.java
@Override public Map<String, String> verify(Map<String, String> postData) { for (UserDataProvider udp : userDataProviders) try {//from www.j a va 2 s . c om return udp.verify(postData); } catch (NoSuchElementException e) { } throw new NoSuchElementException(); }
From source file:Bag.java
/** * Attempts to remove an element//from www.j ava2 s.co m * * @param t * The element to remove * @return t * @throws NoSuchElementException * if the element was not found */ public T take(T t) { int i = this.indexOf(t); if (i == -1) { throw new NoSuchElementException(); } return this.take(i); }
From source file:DepthFirstPathTreeIterator.java
/** Returns the next element in the iteration. //from w ww. j a v a 2 s. c o m @return The next element in the iteration */ public Object next() { throw new NoSuchElementException(); }
From source file:com.phoenixst.collections.FilteredIterator.java
public Object next() { if (!hasNext()) { throw new NoSuchElementException(); }//from w w w. j a v a 2 s . c o m current = next; isCurrentValid = true; isNextValid = false; return current; }
From source file:com.hp.application.automation.tools.octane.tests.xml.AbstractXmlIterator.java
public E next() throws XMLStreamException, IOException, InterruptedException { if (!hasNext()) { throw new NoSuchElementException(); } else {//from ww w . ja va 2s . co m return queue.removeFirst(); } }
From source file:ArrayIterator.java
/** * Returns the next element in the iteration. * // w ww . j a va2 s . c o m * @return The next element in the iteration. * * @throws NoSuchElementException * The are no more elements available. */ public Object next() { if (!hasNext()) throw new NoSuchElementException(); return array[index++]; }