List of usage examples for java.lang Iterable iterator
Iterator<T> iterator();
From source file:com.allogy.io.BulkUpdateInputStream.java
public BulkUpdateInputStream(Iterable<InputStream> innerInputStreams) { headerReader = new StringReader("["); footerReader = new StringReader("]"); currentInputStreamIterator = innerInputStreams.iterator(); moveToNextInnerInputStream();/*from w w w .ja v a 2 s . c o m*/ }
From source file:com.googlecode.jsonschema2pojo.integration.util.Compiler.java
public void compile(File directory, String classpath) { JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler(); StandardJavaFileManager fileManager = javaCompiler.getStandardFileManager(null, null, null); Iterable<? extends JavaFileObject> compilationUnits = fileManager .getJavaFileObjectsFromFiles(findAllSourceFiles(directory)); if (compilationUnits.iterator().hasNext()) { Boolean success = javaCompiler .getTask(null, fileManager, null, asList("-classpath", classpath), null, compilationUnits) .call();/* w w w . j a va 2 s . com*/ assertThat("Compilation was not successful, check stdout for errors", success, is(true)); } }
From source file:edu.pitt.dbmi.ccd.anno.vocabulary.attribute.AttributeResourceAssembler.java
/** * convert Attributes to AttributeResources * * @param attributes entities/*from w ww . ja v a 2s . c om*/ * @return List of resources */ @Override public List<AttributeResource> toResources(Iterable<? extends Attribute> attributes) { // Assert attributes is not empty Assert.isTrue(attributes.iterator().hasNext()); return StreamSupport.stream(attributes.spliterator(), false).map(this::toResource) .collect(Collectors.toList()); }
From source file:org.apereo.openlrs.storage.elasticsearch.NormalizedElasticsearchTierTwoStorage.java
@Override public List<OpenLRSEntity> findAll() { Iterable<Event> events = elasticsearchEventRepository.findAll(); return (List<OpenLRSEntity>) (List<?>) IteratorUtils.toList(events.iterator()); }
From source file:com.graphaware.tx.event.improved.propertycontainer.snapshot.LabelSnapshotIterator.java
public LabelSnapshotIterator(Node node, Iterable<Label> wrappedIterable, TransactionDataContainer transactionDataContainer) { this.node = node; this.wrappedIterator = wrappedIterable.iterator(); this.transactionDataContainer = transactionDataContainer; if (transactionDataContainer.getNodeTransactionData().hasBeenChanged(node)) { this.removedLabelsIterator = transactionDataContainer.getNodeTransactionData().removedLabels(node) .iterator();//from w w w .j a v a2s . co m } else if (transactionDataContainer.getNodeTransactionData().hasBeenDeleted(node)) { this.removedLabelsIterator = transactionDataContainer.getNodeTransactionData().labelsOfDeletedNode(node) .iterator(); } else { this.removedLabelsIterator = EmptyIterator.emptyIterator(); } }
From source file:com.msyla.usergreeter.user.core.dao.UserPreferenceDAOIT.java
@Test public void testFindAll() { Iterable<UserPreference> entities = userPreferenceDAO.findAll(); assertTrue(entities.iterator().hasNext()); }
From source file:com.chinamobile.bcbsp.examples.kmeans.KCentersAggregator.java
@Override public KCentersAggregateValue aggregate(Iterable<KCentersAggregateValue> values) { KCentersAggregateValue kcenters = new KCentersAggregateValue(); Iterator<KCentersAggregateValue> it = values.iterator(); ArrayList<ArrayList<Float>> contents = null; // Init the contents with the first aggregate value. if (it.hasNext()) { contents = (ArrayList<ArrayList<Float>>) it.next().getValue().clone(); }// w ww. j a v a2 s . c o m // Sum the same class's coordinate values and point's counts into the // content. while (it.hasNext()) { ArrayList<ArrayList<Float>> value = it.next().getValue(); // Sum the corresponding element of the array except the first k rows. for (int i = 0; i < value.size(); i++) { ArrayList<Float> center = contents.get(i); ArrayList<Float> valueCenter = value.get(i); for (int j = 0; j < valueCenter.size(); j++) { center.set(j, center.get(j) + valueCenter.get(j)); } contents.set(i, center); } } if (contents != null) { kcenters.setValue(contents); } return kcenters; }
From source file:edu.indiana.d2i.htrc.io.SequentialDataCopyJob.java
private void text2Seq(Iterable<Entry<String, String>> content, ChunkedWriter chunkWriter) throws IOException { if (content != null) { Iterator<Entry<String, String>> iterator = content.iterator(); while (iterator.hasNext()) { Entry<String, String> entry = iterator.next(); chunkWriter.write(entry.getKey(), entry.getValue()); }//from w w w . j a va 2s . co m } }
From source file:de.msg.repository.RouteRepositoryImplJpaTest.java
@Test public void findByDeparture() throws Exception { Iterable<Route> actual = repository.findByDeparture("MUC"); Assert.assertEquals("MUC", actual.iterator().next().getDeparture()); }
From source file:edu.pitt.dbmi.ccd.anno.user.UserResourceAssembler.java
/** * Convert UserAccounts + Persons to UserResources * * @param accounts entities//from ww w.j ava2 s. c om * @return List of resources */ @Override public List<UserResource> toResources(Iterable<? extends UserAccount> accounts) throws IllegalArgumentException { // Assert accounts is not empty Assert.isTrue(accounts.iterator().hasNext()); return StreamSupport.stream(accounts.spliterator(), false).map(this::toResource) .collect(Collectors.toList()); }