List of usage examples for com.google.common.collect ImmutableSet.Builder addAll
boolean addAll(Collection<? extends E> c);
From source file:ru.codeinside.gses.activiti.behavior.TaskFields.java
private <T> Collection<String> unifyNames(String name, String[] aliases) { ImmutableSet.Builder<String> builder = ImmutableSet.builder(); builder.add(name);/*ww w.j av a 2 s.c om*/ builder.addAll(copyOf(aliases)); return Collections2.transform(builder.build(), new Unify()); }
From source file:org.jboss.weld.interceptor.reader.TargetClassInterceptorMetadata.java
private Set<Method> initInterceptorMethods(Map<InterceptionType, List<Method>> interceptorMethodMap) { ImmutableSet.Builder<Method> builder = ImmutableSet.builder(); for (List<Method> methodList : interceptorMethodMap.values()) { builder.addAll(methodList); }//from w w w . j av a 2s . c o m return builder.build(); }
From source file:com.facebook.buck.query.AbstractSetExpression.java
@Override ImmutableSet<QueryTarget> eval(QueryEvaluator evaluator, QueryEnvironment env) throws QueryException { ImmutableSet.Builder<QueryTarget> result = new ImmutableSet.Builder<>(); for (TargetLiteral expr : getWords()) { result.addAll(evaluator.eval(expr, env)); }/*from w ww. ja v a 2 s .c o m*/ return result.build(); }
From source file:org.cebolla.injection.RepositoryRegister.java
public ImmutableCollection<?> getRepositoriesForDataClass(Class<?> dataClass) { ImmutableSet.Builder<Object> result = ImmutableSet.builder(); if (repositories.containsKey(dataClass)) { result.addAll(repositories.get(dataClass)); }//ww w . ja v a2s .c om for (Class<?> iface : dataClass.getInterfaces()) { result.addAll(getRepositoriesForDataClass(iface)); } if (dataClass.getSuperclass() != null) { result.addAll(getRepositoriesForDataClass(dataClass.getSuperclass())); } return result.build(); }
From source file:com.google.devtools.build.lib.actions.CompositeRunfilesSupplier.java
@Override public ImmutableSet<PathFragment> getRunfilesDirs() { ImmutableSet.Builder<PathFragment> result = ImmutableSet.builder(); for (RunfilesSupplier supplier : suppliers) { result.addAll(supplier.getRunfilesDirs()); }//ww w . j a v a2 s .co m return result.build(); }
From source file:dagger2.producers.internal.SetProducer.java
/** * Returns a future {@link Set} whose iteration order is that of the elements given by each of the * producers, which are invoked in the order given at creation. * * <p>If any of the delegate sets, or any elements therein, are null, then this future will fail * with a NullPointerException.//from ww w. jav a 2 s . c o m * * <p>Canceling this future will attempt to cancel all of the component futures, and if any of the * delegate futures fails or is canceled, this one is, too. * * @throws NullPointerException if any of the delegate producers return null */ @Override public ListenableFuture<Set<T>> compute() { List<ListenableFuture<Set<T>>> futureSets = new ArrayList<ListenableFuture<Set<T>>>( contributingProducers.size()); for (Producer<Set<T>> producer : contributingProducers) { ListenableFuture<Set<T>> futureSet = producer.get(); if (futureSet == null) { throw new NullPointerException(producer + " returned null"); } futureSets.add(futureSet); } return Futures.transform(Futures.allAsList(futureSets), new Function<List<Set<T>>, Set<T>>() { @Override public Set<T> apply(List<Set<T>> sets) { ImmutableSet.Builder<T> builder = ImmutableSet.builder(); for (Set<T> set : sets) { builder.addAll(set); } return builder.build(); } }); }
From source file:google.registry.flows.host.HostInfoFlow.java
@Override public EppResponse run() throws EppException { extensionManager.validate(); // There are no legal extensions for this flow. validateClientIsLoggedIn(clientId);//from ww w . j a v a2 s . c o m validateHostName(targetId); DateTime now = clock.nowUtc(); HostResource host = loadAndVerifyExistence(HostResource.class, targetId, now); ImmutableSet.Builder<StatusValue> statusValues = new ImmutableSet.Builder<>(); statusValues.addAll(host.getStatusValues()); if (isLinked(Key.create(host), now)) { statusValues.add(StatusValue.LINKED); } Builder hostInfoDataBuilder = HostInfoData.newBuilder(); // Hosts transfer with their superordinate domains, so for hosts with a superordinate domain, // the client id, last transfer time, and pending transfer status need to be read off of it. If // there is no superordinate domain, the host's own values for these fields will be correct. if (host.isSubordinate()) { DomainResource superordinateDomain = ofy().load().key(host.getSuperordinateDomain()).now() .cloneProjectedAtTime(now); hostInfoDataBuilder.setCurrentSponsorClientId(superordinateDomain.getCurrentSponsorClientId()) .setLastTransferTime(host.computeLastTransferTime(superordinateDomain)); if (superordinateDomain.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) { statusValues.add(StatusValue.PENDING_TRANSFER); } } else { hostInfoDataBuilder.setCurrentSponsorClientId(host.getPersistedCurrentSponsorClientId()) .setLastTransferTime(host.getLastTransferTime()); } return responseBuilder.setResData(hostInfoDataBuilder .setFullyQualifiedHostName(host.getFullyQualifiedHostName()).setRepoId(host.getRepoId()) .setStatusValues(statusValues.build()).setInetAddresses(host.getInetAddresses()) .setCreationClientId(host.getCreationClientId()).setCreationTime(host.getCreationTime()) .setLastEppUpdateClientId(host.getLastEppUpdateClientId()) .setLastEppUpdateTime(host.getLastEppUpdateTime()).build()).build(); }
From source file:com.spectralogic.ds3autogen.java.generators.requestmodels.NotificationRequestGenerator.java
/** * Gets all the required imports that the Request will need in order to properly * generate the Java request code, always including UUID */// w ww.java 2s.com @Override public ImmutableList<String> getAllImports(final Ds3Request ds3Request, final String packageName) { final ImmutableSet.Builder<String> builder = ImmutableSet.builder(); builder.add(getParentImport(ds3Request)); builder.addAll(getImportsFromParamList(ds3Request.getRequiredQueryParams())); builder.addAll(getImportsFromParamList(ds3Request.getOptionalQueryParams())); builder.add("java.util.UUID"); return builder.build().asList(); }
From source file:com.facebook.buck.shell.AbstractGenruleDescription.java
private void addDepsFromParam(BuildTarget target, CellPathResolver cellNames, String paramValue, ImmutableSet.Builder<BuildTarget> targets) { try {//from w ww .j a v a 2 s . c om targets.addAll(getMacroHandlerForParseTimeDeps().extractParseTimeDeps(target, cellNames, paramValue)); } catch (MacroException e) { throw new HumanReadableException(e, "%s: %s", target, e.getMessage()); } }
From source file:com.facebook.buck.rules.AbstractBuilder.java
protected <C extends Comparable<?>> Optional<ImmutableSet<C>> amendSet(Optional<ImmutableSet<C>> existing, C instance) {// w w w . ja v a 2s . c o m ImmutableSet.Builder<C> toReturn = ImmutableSet.builder(); if (existing.isPresent()) { toReturn.addAll(existing.get()); } toReturn.add(instance); return Optional.of(toReturn.build()); }