List of usage examples for java.util NoSuchElementException NoSuchElementException
public NoSuchElementException()
From source file:net.myrrix.common.collection.SamplingLongPrimitiveIterator.java
@Override public long peek() { if (hasNext) { return next; }//from w w w. ja v a2 s. c o m throw new NoSuchElementException(); }
From source file:io.wcm.wcm.ui.extjs.provider.impl.util.PageIterator.java
@Override public Page next() { if (next == null) { throw new NoSuchElementException(); } return seek(); }
From source file:cn.cdwx.jpa.utils.PropertiesLoader.java
/** * ?DoubleProperty.Null./*from www . j a va2 s. c o m*/ */ public Double getDouble(String key) { String value = getValue(key); if (value == null) { throw new NoSuchElementException(); } return Double.valueOf(value); }
From source file:de.qaware.chronix.dtw.WarpPath.java
public ColMajorCell get(int index) { if ((index > this.size()) || (index < 0)) throw new NoSuchElementException(); else/*from w w w . j av a 2s. co m*/ return new ColMajorCell(tsIindexes.get(tsIindexes.size() - index - 1), tsJindexes.get(tsJindexes.size() - index - 1)); }
From source file:com.telefonica.euro_iaas.sdc.pupperwrapper.services.tests.CatalogManagerMongoTest.java
@Before public void setUp() { mongoTemplateMock = mock(MongoTemplate.class); catalogManagerMongo = new CatalogManagerMongoImpl4Test(); catalogManagerMongo.setMongoTemplate(mongoTemplateMock); final Node node = new Node(); node.setId("test"); node.setGroupName("group"); node.setManifestGenerated(true);// w w w . ja v a 2 s . c o m Software soft = new Software(); soft.setName("test"); soft.setVersion("1.0.0"); soft.setAction(Action.INSTALL); node.addSoftware(soft); final Node node2 = new Node(); node2.setId("test2"); node2.setGroupName("group2"); node2.setManifestGenerated(true); final Node node3 = new Node(); node3.setId("test3"); node3.setGroupName("group2"); node3.setManifestGenerated(true); // Query query = mock(Query.class); Query query = new Query(Criteria.where("id").is("test")); when(mongoTemplateMock.findOne(query, Node.class)).thenReturn(node); query = new Query(Criteria.where("id").is("test3")); when(mongoTemplateMock.findOne(query, Node.class)).thenThrow(new NoSuchElementException()); when(mongoTemplateMock.findAll(Node.class)).thenReturn(new ArrayList<Node>() { { add(node); add(node2); add(node3); } }).thenReturn(new ArrayList<Node>() { { add(node); add(node2); add(node3); } }).thenReturn(new ArrayList<Node>() { { add(node); add(node2); } }); Query queryFindOK = new Query(Criteria.where("groupName").is("groupNameOK")); when(mongoTemplateMock.find(queryFindOK, Node.class)).thenReturn(new ArrayList<Node>() { { add(node); } }); Query queryFindErr = new Query(Criteria.where("groupName").is("groupNameErr")); when(mongoTemplateMock.find(queryFindErr, Node.class)).thenReturn(null); }
From source file:ArrayRangeIterator.java
/** * Get next iteration element./*w w w. ja va 2 s .c o m*/ * * @return next iteration element * @exception NoSuchElementException if past end of iteration */ public Object next() { if (m_offset < m_limit) { return m_array[m_offset++]; } else { throw new NoSuchElementException(); } }
From source file:info.magnolia.cms.gui.controlx.list.ListModelIteratorImpl.java
/** * move next/*from w w w .jav a 2 s . c o m*/ */ public Object next() { if (this.next == null) { throw new NoSuchElementException(); } this.current = this.next; this.pos++; prefetchNext(); return this.current; }
From source file:org.apache.nifi.minifi.c2.provider.nifi.rest.TemplatesIterator.java
@Override public Pair<String, String> next() { if (next == null) { throw new NoSuchElementException(); }//from w w w . ja va 2 s .co m try { return next; } finally { try { next = getNext(); } catch (IOException e) { throw new TemplatesIteratorException(e); } } }
From source file:$.PropertiesLoader.java
/** * ?DoubleProperty.Null.//ww w . j a va 2 s.com */ public Double getDouble(String key) { String value = getValue(key); if (value == null) { throw new NoSuchElementException(); } return Double.valueOf(value); }
From source file:at.molindo.notify.model.BeanParams.java
@Override public Iterator<ParamValue> iterator() { return new Iterator<ParamValue>() { private final Iterator<PropertyDescriptor> _iter = getDescriptorsIter(); private ParamValue _next = findNext(); private ParamValue findNext() { while (_iter.hasNext()) { PropertyDescriptor pd = _iter.next(); if (pd.getWriteMethod() == null || pd.getReadMethod() == null) { continue; }//from w w w . ja v a2 s .com Object value = invoke(pd.getReadMethod()); if (value == null) { continue; } return Param.p(pd.getPropertyType(), pd.getName()).paramValue(value); } return null; } @Override public boolean hasNext() { return _next != null; } @Override public ParamValue next() { if (!hasNext()) { throw new NoSuchElementException(); } ParamValue next = _next; _next = findNext(); return next; } @Override public void remove() { throw new UnsupportedOperationException(); } }; }