List of usage examples for com.google.common.collect ImmutableSet copyOf
public static <E> ImmutableSet<E> copyOf(Iterator<? extends E> elements)
From source file:com.facebook.presto.recordservice.RecordServiceConnectorConfig.java
public static ImmutableSet<HostAddress> parsePlannerHostPorts(String plannerHostPorts) { Splitter splitter = Splitter.on(',').omitEmptyStrings().trimResults(); return ImmutableSet.copyOf(transform(splitter.split(plannerHostPorts), (value -> HostAddress.fromString(value).withDefaultPort(RECORDSERVICE_PLANNER_DEFAULT_PORT)))); }
From source file:net.cyphoria.cylus.domain.Kontenplan.java
public Kontenplan(final Iterable<Konto> kontoListe) { konten = ImmutableSet.copyOf(kontoListe); }
From source file:com.axemblr.service.cm.models.cm.ServiceSetupList.java
@JsonCreator public ServiceSetupList(@JsonProperty("items") Set<ServiceSetupInfo> items) { this.items = (items == null) ? ImmutableSet.<ServiceSetupInfo>of() : ImmutableSet.copyOf(items); }
From source file:dagger.internal.codegen.DaggerGraphs.java
/** * Returns a shortest path from {@code nodeU} to {@code nodeV} in {@code graph} as a list of the * nodes visited in sequence, including both {@code nodeU} and {@code nodeV}. (Note that there may * be many possible shortest paths.)//w w w . j ava2 s . c o m * * <p>If {@code nodeV} is not {@link * com.google.common.graph.Graphs#reachableNodes(com.google.common.graph.Graph, Object) reachable} * from {@code nodeU}, the list returned is empty. * * @throws IllegalArgumentException if {@code nodeU} or {@code nodeV} is not present in {@code * graph} */ public static <N> ImmutableList<N> shortestPath(SuccessorsFunction<N> graph, N nodeU, N nodeV) { if (nodeU.equals(nodeV)) { return ImmutableList.of(nodeU); } Set<N> successors = ImmutableSet.copyOf(graph.successors(nodeU)); if (successors.contains(nodeV)) { return ImmutableList.of(nodeU, nodeV); } Map<N, N> visitedNodeToPathPredecessor = new HashMap<>(); // encodes shortest path tree for (N node : successors) { visitedNodeToPathPredecessor.put(node, nodeU); } Queue<N> currentNodes = new ArrayDeque<N>(successors); Queue<N> nextNodes = new ArrayDeque<N>(); // Perform a breadth-first traversal starting with the successors of nodeU. while (!currentNodes.isEmpty()) { while (!currentNodes.isEmpty()) { N currentNode = currentNodes.remove(); for (N nextNode : graph.successors(currentNode)) { if (visitedNodeToPathPredecessor.containsKey(nextNode)) { continue; // we already have a shortest path to nextNode } visitedNodeToPathPredecessor.put(nextNode, currentNode); if (nextNode.equals(nodeV)) { ImmutableList.Builder<N> builder = ImmutableList.builder(); N node = nodeV; builder.add(node); while (!node.equals(nodeU)) { node = visitedNodeToPathPredecessor.get(node); builder.add(node); } return builder.build().reverse(); } nextNodes.add(nextNode); } } Queue<N> emptyQueue = currentNodes; currentNodes = nextNodes; nextNodes = emptyQueue; // reusing empty queue faster than allocating new one } return ImmutableList.of(); }
From source file:com.proofpoint.http.server.CidrSet.java
private CidrSet(Collection<Inet4Network> cidrs) { this.cidrs = ImmutableSet.copyOf(cidrs); }
From source file:com.mastfrog.scamper.MessageTypeRegistry.java
MessageTypeRegistry(Set<MessageType> types) {
this.types = ImmutableSet.copyOf(types);
}
From source file:com.google.gerrit.server.account.ListGroupMembership.java
public ListGroupMembership(Iterable<AccountGroup.UUID> groupIds) { this.groups = ImmutableSet.copyOf(groupIds); }
From source file:org.eclipse.sirius.business.api.helper.SelectionDescriptionHelper.java
/** * Compute the TreeItemWrapper corresponding to this * {@link SelectionDescription}.// w w w. j a v a 2s.c o m * * @param selectionDescription * the selection description * @param container * the semantic element * @param interpreter * the interpreter used to compute expressions of the selection * description * @param input * the TreeItemWrapper to complete */ public static void computeInput(final SelectionDescription selectionDescription, final EObject container, final IInterpreter interpreter, final TreeItemWrapper input) { final Collection<EObject> referencingENode = ImmutableSet.copyOf(RuntimeLoggerManager.INSTANCE .decorate(interpreter).evaluateCollection(container, selectionDescription, DescriptionPackage.eINSTANCE.getSelectionDescription_CandidatesExpression())); if (selectionDescription.isTree()) { final Collection<EObject> referencingRoots = RuntimeLoggerManager.INSTANCE.decorate(interpreter) .evaluateCollection(container, selectionDescription, DescriptionPackage.eINSTANCE.getSelectionDescription_RootExpression()); final Iterator<EObject> iterRoots = referencingRoots.iterator(); while (iterRoots.hasNext()) { final EObject refRoot = iterRoots.next(); if (referencingENode.contains(refRoot)) { final TreeItemWrapper treeItem = new TreeItemWrapper(refRoot, input); input.getChildren().add(treeItem); SelectionDescriptionHelper.computeChildren(selectionDescription, referencingENode, interpreter, treeItem, refRoot); } } } else { final Iterator<EObject> iterRoots = referencingENode.iterator(); while (iterRoots.hasNext()) { final EObject refRoot = iterRoots.next(); if (referencingENode.contains(refRoot)) { final TreeItemWrapper treeItem = new TreeItemWrapper(refRoot, input); input.getChildren().add(treeItem); } } } }
From source file:org.gradle.api.internal.provider.LockableSetProperty.java
@Override protected Set<T> immutableCopy(Set<T> value) { return ImmutableSet.copyOf(value); }
From source file:org.gradle.api.internal.provider.DefaultSetProperty.java
@Override protected Set<T> fromValue(Collection<T> values) { return ImmutableSet.copyOf(values); }