List of usage examples for java.lang Iterable iterator
Iterator<T> iterator();
From source file:com.googlecode.spring.appengine.objectify.repository.SimpleOfyRepository.java
@Override public <S extends T> List<S> save(Iterable<S> entities) { Assert.notNull(entities, "The iterable of entities must not be null"); save().entities(entities).now();//from w w w . ja v a2 s. c om List<S> temp = new ArrayList<S>(); Iterator<S> iterator = entities.iterator(); while (iterator.hasNext()) { temp.add(iterator.next()); } return temp; }
From source file:com.neo4j.jena.graph.NeoGraph.java
/** * Checks if the grpah is empty or not/*from www.j a v a2 s.c om*/ */ @Override public boolean isEmpty() { Transaction tx = graphdb.beginTx(); Iterable<org.neo4j.graphdb.Node> nodes = GlobalGraphOperations.at(graphdb).getAllNodes(); boolean empty = nodes.iterator().hasNext(); tx.success(); return !empty; }
From source file:com.daphne.es.common.repository.support.SimpleBaseRepository.java
@Transactional @Override/* w w w .j a va2s.c o m*/ public void deleteInBatch(final Iterable<M> entities) { Iterator<M> iter = entities.iterator(); if (entities == null || !iter.hasNext()) { return; } Set models = Sets.newHashSet(iter); boolean logicDeleteableEntity = LogicDeleteable.class.isAssignableFrom(this.entityClass); if (logicDeleteableEntity) { String ql = String.format(LOGIC_DELETE_ALL_QUERY_STRING, entityName); repositoryHelper.batchUpdate(ql, models); } else { String ql = String.format(DELETE_ALL_QUERY_STRING, entityName); repositoryHelper.batchUpdate(ql, models); } }
From source file:uk.gov.nationalarchives.discovery.taxonomy.common.service.impl.EvaluationServiceTest.java
private void assertThatTestDocDbContainsDocsWithLegacyCategories() { assertThat(testDocumentRepository.count(), is(equalTo(1l))); Iterable<TestDocument> trainingDocuments = testDocumentRepository.findAll(); assertThat(trainingDocuments, is(notNullValue())); TestDocument doc = trainingDocuments.iterator().next(); assertThat(doc, is(notNullValue())); assertThat(doc.getLegacyCategories(), is(not(emptyArray()))); }
From source file:name.martingeisse.webide.features.java.compiler.classpath.PlatformClasspathShieldFileManager.java
@Override public Iterable<JavaFileObject> list(final Location location, final String packageName, final Set<Kind> kinds, final boolean recurse) throws IOException { if (location == StandardLocation.PLATFORM_CLASS_PATH) { logger.trace("listing files from standard file manager, location [" + location + "], package [" + packageName + "], kinds [" + StringUtils.join(kinds, ", ") + "], recurse [" + recurse + "]"); final Iterable<JavaFileObject> files = super.list(location, packageName, kinds, recurse); logger.trace("contributed files from the standard file manager: " + StringUtils.join(files.iterator(), ", ")); return files; } else {/*from w w w .j a v a 2 s . c o m*/ logger.trace("blocking file list from standard file manager, location [" + location + "], package [" + packageName + "], kinds [" + StringUtils.join(kinds, ", ") + "], recurse [" + recurse + "]"); return new EmptyIterable<JavaFileObject>(); } }
From source file:io.getlime.security.powerauth.app.server.service.behavior.ApplicationServiceBehavior.java
/** * Get application list in the PowerAuth Server instance. * * @return List of applications./*w ww . j a va 2 s. c o m*/ */ public GetApplicationListResponse getApplicationList() { Iterable<ApplicationEntity> result = applicationRepository.findAll(); GetApplicationListResponse response = new GetApplicationListResponse(); for (Iterator<ApplicationEntity> iterator = result.iterator(); iterator.hasNext();) { ApplicationEntity application = (ApplicationEntity) iterator.next(); GetApplicationListResponse.Applications app = new GetApplicationListResponse.Applications(); app.setId(application.getId()); app.setApplicationName(application.getName()); response.getApplications().add(app); } return response; }
From source file:com.infinities.nova.securitygroups.api.DaseinSecurityGroupsApi.java
@Override public List<SecurityGroup> getSecurityGroups(OpenstackRequestContext context, String projectId, String serverId) throws Exception { if (context == null) { context = Context.getAdminContext("no"); }// w ww. j a va 2 s . c o m AsyncResult<Iterable<String>> result = this.getVirtualMahcineSupport(context.getProjectId()) .listFirewalls(serverId); Iterable<String> iterable = result.get(); List<SecurityGroup> securityGroups = new ArrayList<SecurityGroup>(); Iterator<String> iterator = iterable.iterator(); while (iterator.hasNext()) { String firewallId = iterator.next(); securityGroups.add(getSecurityGroup(context, projectId, firewallId)); } return securityGroups; }
From source file:com.simphony.managedbeans.ItineraryBean.java
/** * Llenamos lista de itinerarios// w ww.ja v a 2 s. c om */ private void fillItineraries() { list.clear(); Iterable<Itinerary> c = this.itineraryService.getItineraryRepository().findAll(sortByKeyId()); Iterator<Itinerary> cu = c.iterator(); while (cu.hasNext()) { list.add(cu.next()); } }
From source file:com.infinities.nova.volumes.api.DaseinVolumesApi.java
@Override public List<Volume> getVolumes(OpenstackRequestContext context, String projectId) throws Exception { if (context == null) { context = Context.getAdminContext("no"); }//from w w w . j a va 2s . c om AsyncResult<Iterable<org.dasein.cloud.compute.Volume>> result = this.getSupport(context.getProjectId()) .listVolumes(); AsyncResult<Iterable<VolumeProduct>> types = this.getSupport(context.getProjectId()).listVolumeProducts(); Iterable<org.dasein.cloud.compute.Volume> iterable = result.get(); List<Volume> volumes = new ArrayList<Volume>(); Iterator<org.dasein.cloud.compute.Volume> iterator = iterable.iterator(); while (iterator.hasNext()) { org.dasein.cloud.compute.Volume volume = iterator.next(); volumes.add(toVolume(volume, types.get())); } return volumes; }
From source file:com.infinities.nova.securitygroups.api.DaseinSecurityGroupsApi.java
@Override public List<SecurityGroup> getSecurityGroups(OpenstackRequestContext context, String projectId) throws Exception { if (context == null) { context = Context.getAdminContext("no"); }/*from w w w. j ava 2 s . c o m*/ AsyncResult<Iterable<Firewall>> result = this.getSupport(context.getProjectId()).list(); Iterable<Firewall> iterable = result.get(); List<SecurityGroup> securityGroups = new ArrayList<SecurityGroup>(); Iterator<Firewall> iterator = iterable.iterator(); while (iterator.hasNext()) { Firewall firewall = iterator.next(); securityGroups.add(toSecurityGroup(context, firewall, projectId)); } return securityGroups; }