List of usage examples for com.google.common.collect ImmutableSet builder
public static <E> Builder<E> builder()
From source file:edu.mit.streamjit.util.affinity.Affinity.java
private static ImmutableSet<Integer> expand(long mask) { ImmutableSet.Builder<Integer> builder = ImmutableSet.builder(); for (int i = 0; i < Long.SIZE && mask != 0; ++i) { if ((mask & 1) != 0) builder.add(i);//from w w w . j av a2 s . c o m mask >>>= 1; } return builder.build(); }
From source file:zipkin2.storage.cassandra.v1.InsertTraceIdBySpanName.java
@Override public Set<String> partitionKeys(V1Span span) { if (span.name() == null) return Collections.emptySet(); ImmutableSet.Builder<String> result = ImmutableSet.builder(); for (String serviceName : span.serviceNames()) { result.add(serviceName + "." + span.name()); }//www.j a v a2s . c om return result.build(); }
From source file:com.android.build.gradle.internal.dsl.AbiSplitOptions.java
@Override protected ImmutableSet<String> getAllowedValues() { ImmutableSet.Builder<String> builder = ImmutableSet.builder(); for (Abi abi : NdkHandler.getAbiList()) { builder.add(abi.getName());//from w ww . ja v a2 s . co m } return builder.build(); }
From source file:uk.co.lucasweb.stream.ImmutableSetCollector.java
@Override public BinaryOperator<ImmutableSet.Builder<E>> combiner() { return (left, right) -> { left.addAll(right.build());//from w w w. jav a 2 s.com return left; }; }
From source file:org.gradle.internal.ImmutableActionSet.java
private static <T> void unpackAction(Action<? super T> action, ImmutableSet.Builder<Action<? super T>> builder) { if (action instanceof ImmutableActionSet) { ImmutableActionSet<T> immutableSet = (ImmutableActionSet<T>) action; immutableSet.unpackInto(builder); } else {//w w w .ja va 2s . c o m builder.add(action); } }
From source file:de.metas.ui.web.window.datatypes.DocumentIdsSelection.java
public static DocumentIdsSelection ofStringSet(final Collection<String> stringDocumentIds) { if (stringDocumentIds == null || stringDocumentIds.isEmpty()) { return EMPTY; }//from w w w . j a v a 2s .c o m final ImmutableSet.Builder<DocumentId> documentIdsBuilder = ImmutableSet.builder(); for (final String documentIdStr : stringDocumentIds) { if (ALL_String.equals(documentIdStr)) { return ALL; } documentIdsBuilder.add(DocumentId.of(documentIdStr)); } final ImmutableSet<DocumentId> documentIds = documentIdsBuilder.build(); if (documentIds.isEmpty()) { return EMPTY; } return new DocumentIdsSelection(false, documentIds); }
From source file:org.onlab.rest.AbstractWebApplication.java
/** * Returns the aggregate set of resources, writers and mappers combined * with a default set of such web entities. * * @param classes set of resources, writers and mappers * @return combined set of web entities//w ww . j av a 2s. c o m */ protected Set<Class<?>> getClasses(Class<?>... classes) { ImmutableSet.Builder<Class<?>> builder = ImmutableSet.builder(); builder.add(ServiceNotFoundMapper.class, EntityNotFoundMapper.class, NotFoundMapper.class, ServerErrorMapper.class, BadRequestMapper.class, WebApplicationExceptionMapper.class, IllegalArgumentExceptionMapper.class, IllegalStateExceptionMapper.class, JsonBodyWriter.class); builder.add(classes); return builder.build(); }
From source file:dagger.internal.codegen.writer.TypeVariableName.java
@Override public Set<ClassName> referencedClasses() { ImmutableSet.Builder<ClassName> builder = new ImmutableSet.Builder<ClassName>(); for (TypeName bound : extendsBounds) { builder.addAll(bound.referencedClasses()); }// w w w .j av a 2s . co m return builder.build(); }
From source file:org.tensorics.core.tensor.operations.OngoingMapOut.java
private static <C, C1 extends C> Set<?> coordinatesExcept(Collection<?> coordinates, Class<C1> dimension) { ImmutableSet.Builder<Object> builder = ImmutableSet.builder(); for (Object coordinate : coordinates) { if (!dimension.isInstance(coordinate)) { builder.add(coordinate);/*from w ww. j a v a 2 s . c om*/ } } return builder.build(); }
From source file:com.tngtech.archunit.lang.syntax.Transformers.java
static ClassesTransformer<JavaCodeUnit> codeUnits() { return new AbstractClassesTransformer<JavaCodeUnit>("code units") { @Override//from www . j a v a 2 s. com public Iterable<JavaCodeUnit> doTransform(JavaClasses collection) { ImmutableSet.Builder<JavaCodeUnit> result = ImmutableSet.builder(); for (JavaClass javaClass : collection) { result.addAll(javaClass.getCodeUnits()); } return result.build(); } }; }