List of usage examples for com.google.common.collect Iterables addAll
public static <T> boolean addAll(Collection<T> addTo, Iterable<? extends T> elementsToAdd)
From source file:org.jclouds.cloudstack.compute.options.CloudStackTemplateOptions.java
/** * @see DeployVirtualMachineOptions#securityGroupIds *//*from ww w . j a v a2 s .c o m*/ public CloudStackTemplateOptions securityGroupIds(Iterable<String> securityGroupIds) { Iterables.addAll(this.securityGroupIds, checkNotNull(securityGroupIds, "securityGroupIds was null")); return this; }
From source file:org.gitools.heatmap.Bookmarks.java
public Bookmark createNew(Heatmap heatmap, String bookmarkName, String description, int[] include) { String name = bookmarkName;/* w w w. j a v a2s.c o m*/ int counter = 1; while (nameOccupied(name)) { name = bookmarkName + "-" + counter++; } if (include == null || include.length == 0) { include = new int[] { ROWS, COLUMNS, LAYER }; } List<String> rows = null; List<String> cols = null; if (Ints.contains(include, ROWS)) { rows = new ArrayList<>(); Iterables.addAll(rows, heatmap.getRows()); } if (Ints.contains(include, COLUMNS)) { cols = new ArrayList<>(); Iterables.addAll(cols, heatmap.getColumns()); } String layerId = Ints.contains(include, LAYER) ? heatmap.getLayers().getTopLayer().getId() : null; Bookmark b = new Bookmark(name, rows, cols, layerId); b.setDescription(description); add(b); return b; }
From source file:org.apache.druid.server.http.MetadataResource.java
@GET @Path("/datasources") @Produces(MediaType.APPLICATION_JSON)/*from ww w.j a v a 2 s. c o m*/ public Response getDatabaseDataSources(@QueryParam("full") final String full, @QueryParam("includeDisabled") final String includeDisabled, @Context final HttpServletRequest req) { final Collection<ImmutableDruidDataSource> druidDataSources = metadataSegmentManager.getInventory(); final Set<String> dataSourceNamesPreAuth; if (includeDisabled != null) { dataSourceNamesPreAuth = Sets.newTreeSet(metadataSegmentManager.getAllDatasourceNames()); } else { dataSourceNamesPreAuth = Sets .newTreeSet(Iterables.transform(druidDataSources, ImmutableDruidDataSource::getName)); } final Set<String> dataSourceNamesPostAuth = Sets.newTreeSet(); Function<String, Iterable<ResourceAction>> raGenerator = datasourceName -> { return Collections.singletonList(AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(datasourceName)); }; Iterables.addAll(dataSourceNamesPostAuth, AuthorizationUtils.filterAuthorizedResources(req, dataSourceNamesPreAuth, raGenerator, authorizerMapper)); // Cannot do both includeDisabled and full, let includeDisabled take priority // Always use dataSourceNamesPostAuth to determine the set of returned dataSources if (full != null && includeDisabled == null) { return Response.ok().entity(Collections2.filter(druidDataSources, dataSource -> dataSourceNamesPostAuth.contains(dataSource.getName()))).build(); } else { return Response.ok().entity(dataSourceNamesPostAuth).build(); } }
From source file:com.zimbra.soap.admin.type.CertInfo.java
public void setCertInfos(Iterable<org.w3c.dom.Element> certInfos) { this.certInfos.clear(); if (certInfos != null) { Iterables.addAll(this.certInfos, certInfos); }/*from w ww .ja v a2 s . c o m*/ }
From source file:org.polarsys.reqcycle.utils.ocl.ZigguratOCLPlugin.java
private static Collection<DefOperationCS> getOperations(BaseResource resource) { Collection<DefOperationCS> result = Lists.newArrayList(); EList<EObject> contents = resource.getContents(); if (contents.size() == 1) { EObject root = contents.get(0);/*from w w w . j a v a 2s . c o m*/ if (root instanceof CompleteOCLDocumentCS) { EList<org.eclipse.ocl.examples.xtext.completeocl.completeoclcs.ContextDeclCS> contexts = ((CompleteOCLDocumentCS) root) .getContexts(); for (org.eclipse.ocl.examples.xtext.completeocl.completeoclcs.ContextDeclCS context : contexts) { if (context instanceof ClassifierContextDeclCS) { EList<DefCS> definitions = ((ClassifierContextDeclCS) context).getDefinitions(); Iterables.addAll(result, Iterables.filter(definitions, DefOperationCS.class)); } } } } return result; }
From source file:org.gradle.model.internal.manage.schema.extract.DefaultModelSchemaExtractor.java
private void pushUnsatisfiedDependencies( Iterable<? extends DefaultModelSchemaExtractionContext<?>> allDependencies, Queue<DefaultModelSchemaExtractionContext<?>> dependencyQueue, final ModelSchemaCache cache) { Iterables.addAll(dependencyQueue, Iterables.filter(allDependencies, new Predicate<ModelSchemaExtractionContext<?>>() { public boolean apply(ModelSchemaExtractionContext<?> dependency) { return cache.get(dependency.getType()) == null; }/* ww w. j a v a2s . co m*/ })); }
From source file:com.gantzgulch.sharing.domain.SharedFile.java
public List<SharedFileComment> getRootComments() { List<SharedFileComment> rootComments = new ArrayList<SharedFileComment>(); Iterables.addAll(rootComments, Iterables.filter(comments, new SharedFileComment.RootCommentPredicate())); Collections.sort(rootComments, new SharedFileComment.DateComparator()); return rootComments; }
From source file:eu.interedition.collatex.util.VariantGraphTraversal.java
public Iterable<VariantGraph.Edge> edges() { return new Iterable<VariantGraph.Edge>() { @Override/*from ww w . j av a 2s. c o m*/ public Iterator<VariantGraph.Edge> iterator() { return new AbstractIterator<VariantGraph.Edge>() { private final Iterator<VariantGraph.Vertex> vertexIt = VariantGraphTraversal.this.iterator(); private final Queue<VariantGraph.Edge> queue = new ArrayDeque<VariantGraph.Edge>(); @Override protected VariantGraph.Edge computeNext() { if (queue.isEmpty()) { if (vertexIt.hasNext()) { Iterables.addAll(queue, vertexIt.next().outgoing(witnesses)); } } return (queue.isEmpty() ? endOfData() : queue.remove()); } }; } }; }
From source file:com.zimbra.soap.account.type.CertificateAltNames.java
public void setOtherName(List<String> otherName) { if (this.otherName != null) { this.otherName.clear(); } else {//from w w w . j av a 2s. co m this.otherName = Lists.newArrayList(); } if (otherName != null) { Iterables.addAll(this.otherName, otherName); } }