List of usage examples for com.google.common.collect ImmutableSet builder
public static <E> Builder<E> builder()
From source file:org.apache.abdera2.common.templates.DefaultingContext.java
public Iterator<String> iterator() { ImmutableSet.Builder<String> set = ImmutableSet.builder(); for (String name : subcontext) set.add(name);/*from ww w . j a v a2 s.c o m*/ for (String name : defaults) set.add(name); return set.build().iterator(); }
From source file:dagger.internal.codegen.TypeCheckingProcessingStep.java
@Override public ImmutableSet<Element> process(SetMultimap<Class<? extends Annotation>, Element> elementsByAnnotation) { ImmutableSet.Builder<Element> deferredElements = ImmutableSet.builder(); ImmutableSetMultimap.copyOf(elementsByAnnotation).inverse().asMap().forEach((element, annotations) -> { try {/* w w w . jav a 2 s .co m*/ process(downcaster.apply(element), ImmutableSet.copyOf(annotations)); } catch (TypeNotPresentException e) { deferredElements.add(element); } }); return deferredElements.build(); }
From source file:org.apache.sentry.core.common.ActiveRoleSet.java
private ActiveRoleSet(boolean allRoles, Set<String> roles) { this.allRoles = allRoles; ImmutableSet.Builder<String> setBuilder = ImmutableSet.builder(); for (String role : roles) { setBuilder.add(role.toLowerCase()); }/*from w w w. jav a 2 s. co m*/ this.roles = setBuilder.build(); }
From source file:org.graylog2.shared.inputs.InputRegistry.java
public Set<IOState<MessageInput>> getRunningInputs() { ImmutableSet.Builder<IOState<MessageInput>> runningInputs = ImmutableSet.builder(); for (IOState<MessageInput> inputState : this) { if (inputState.getState() == IOState.Type.RUNNING) runningInputs.add(inputState); }//from ww w . j a v a 2 s . c om return runningInputs.build(); }
From source file:com.facebook.buck.cli.FetchTargetNodeToBuildRuleTransformer.java
public FetchTargetNodeToBuildRuleTransformer(ImmutableSet<Description<?>> descriptions) { this.descriptions = descriptions; this.downloadableTargets = ImmutableSet.builder(); this.delegate = new DefaultTargetNodeToBuildRuleTransformer(); }
From source file:org.sosy_lab.cpachecker.cpa.pointer2.util.ExplicitLocationSet.java
@Override public LocationSet addElement(String pLocation) { if (explicitSet.contains(pLocation)) { return this; }// w w w. j a va 2s. c o m ImmutableSet.Builder<String> builder = ImmutableSet.builder(); builder.addAll(explicitSet).add(pLocation); return new ExplicitLocationSet(builder.build()); }
From source file:com.google.devtools.build.lib.sandbox.SandboxHelpers.java
public static ImmutableSet<PathFragment> getOutputFiles(Spawn spawn) { Builder<PathFragment> outputFiles = ImmutableSet.builder(); for (PathFragment optionalOutput : spawn.getOptionalOutputFiles()) { Preconditions.checkArgument(!optionalOutput.isAbsolute()); outputFiles.add(optionalOutput); }//from w w w. ja v a 2 s .c o m for (ActionInput output : spawn.getOutputFiles()) { outputFiles.add(new PathFragment(output.getExecPathString())); } return outputFiles.build(); }
From source file:tech.mcprison.prison.internal.events.inventory.InventoryDragEvent.java
public InventoryDragEvent(Viewable transaction, ItemStack newCursor, ItemStack oldCursor, boolean right, Map<Integer, ItemStack> slots) { super(transaction); this.right = right; this.newCursor = newCursor; this.oldCursor = oldCursor; this.slots = slots; ImmutableSet.Builder<Integer> b = ImmutableSet.builder(); for (Integer slot : slots.keySet()) { b.add(transaction.convertSlot(slot)); }// ww w.j a va2 s . c o m this.parsedSlots = b.build(); }
From source file:com.google.devtools.build.lib.analysis.CompositeRunfilesSupplier.java
@Override public Iterable<Artifact> getArtifacts() { ImmutableSet.Builder<Artifact> result = ImmutableSet.builder(); result.addAll(first.getArtifacts()); result.addAll(second.getArtifacts()); return result.build(); }
From source file:es.udc.pfc.gamelib.chess.pieces.ChessBishop.java
public final ImmutableSet<Position> getMiniMoves(final ChessBoard board) { final ImmutableSet.Builder<Position> moves = ImmutableSet.builder(); moves.addAll(getStandardMoves(board)); for (final int[] element : special) { final Position pos = board.getPositionFor(this).relative(element[0], element[1]); if (board.isValidPosition(pos) && !board.isPieceAt(pos)) { moves.add(pos);//from w ww . j a v a 2 s.c o m } } return moves.build(); }