com.google.common.collect.ImmutableSet#copyOf ( )源码实例Demo

下面列出了com.google.common.collect.ImmutableSet#copyOf ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: bazel   文件: ActionGraphDump.java
public ActionGraphDump(
    List<String> actionGraphTargets,
    boolean includeActionCmdLine,
    boolean includeArtifacts,
    AqueryActionFilter actionFilters,
    boolean includeParamFiles) {
  this.actionGraphTargets = ImmutableSet.copyOf(actionGraphTargets);
  this.includeActionCmdLine = includeActionCmdLine;
  this.includeArtifacts = includeArtifacts;
  this.actionFilters = actionFilters;
  this.includeParamFiles = includeParamFiles;

  knownRuleClassStrings = new KnownRuleClassStrings(actionGraphBuilder);
  knownArtifacts = new KnownArtifacts(actionGraphBuilder);
  knownConfigurations = new KnownConfigurations(actionGraphBuilder);
  knownNestedSets = new KnownNestedSets(actionGraphBuilder, knownArtifacts);
  knownAspectDescriptors = new KnownAspectDescriptors(actionGraphBuilder);
  knownTargets = new KnownTargets(actionGraphBuilder, knownRuleClassStrings);
}
 
@Test
public void streamTruncationRecordTest() {
    Map<StreamSegmentRecord, Integer> span = new HashMap<>();
    span.put(StreamSegmentRecord.newSegmentRecord(0, 0, 0L, 0.0, 1.0), 0);
    Map<Long, Long> streamCut = new HashMap<>();
    streamCut.put(0L, 0L);
    Set<Long> set = new HashSet<>();
    set.add(0L);
    StreamTruncationRecord record = new StreamTruncationRecord(ImmutableMap.copyOf(streamCut),
            ImmutableMap.copyOf(span), ImmutableSet.copyOf(set), ImmutableSet.copyOf(set), 0L, true);
    assertEquals(StreamTruncationRecord.fromBytes(record.toBytes()), record);
    assertTrue(record.isUpdating());
    StreamTruncationRecord completed = StreamTruncationRecord.complete(record);
    assertEquals(StreamTruncationRecord.fromBytes(completed.toBytes()), completed);
    assertTrue(!completed.isUpdating());
}
 
源代码3 项目: RDFUnit   文件: BatchShapeReader.java
public Set<Shape> getShapesFromModel(Model model) {
    ConcurrentLinkedQueue<Shape> shapes = new ConcurrentLinkedQueue<>();

    ImmutableSet.Builder<Resource> shapeResourceBuilder = ImmutableSet.builder();

    addShapesAsInstancesOf(model, shapeResourceBuilder);
    addShapesAsObjectsOf(model, shapeResourceBuilder);
    addShapesAsSubjectsOf(model, shapeResourceBuilder);

    ImmutableSet<Resource> shapeResources = shapeResourceBuilder.build();
    shapeResources.forEach(resource -> shapes.add(ShapeReader.create().read(resource)));
    addShapeListsAsObjectsOf(model).forEach(ls -> {
        shapes.add(ls);
        shapes.addAll(ls.getShapes());
    });

    return ImmutableSet.copyOf(shapes);
}
 
源代码4 项目: james-project   文件: FetchData.java
private FetchData(EnumSet<Item> itemToFetch, Set<BodyFetchElement> bodyElements, boolean setSeen, long changedSince, boolean vanished) {
    this.itemToFetch = EnumSet.copyOf(itemToFetch);
    this.bodyElements = ImmutableSet.copyOf(bodyElements);
    this.setSeen = setSeen;
    this.changedSince = changedSince;
    this.vanished = vanished;
}
 
源代码5 项目: sailfish-core   文件: FileAuthStorage.java
@Override
public Set<User> getUsers() {
    try {
        usersLock.readLock().lock();
        return ImmutableSet.copyOf(users);
    } finally {
        usersLock.readLock().unlock();
    }
}
 
源代码6 项目: onos   文件: DistributedRouteStore.java
@Override
public Collection<RouteSet> getRoutes(RouteTableId table) {
    RouteTable routeTable = routeTables.get(table);
    if (routeTable == null) {
        return Collections.emptySet();
    } else {
        return ImmutableSet.copyOf(routeTable.getRoutes());
    }
}
 
源代码7 项目: genie   文件: Criterion.java
/**
 * Copy the contents of the given {@link Criterion} but use the supplied status.
 *
 * @param criterion The {@link Criterion} to copy
 * @param status    The status to use
 */
public Criterion(final Criterion criterion, final String status) {
    this.id = criterion.id;
    this.name = criterion.name;
    this.version = criterion.version;
    this.status = status;
    this.tags = ImmutableSet.copyOf(criterion.getTags());
}
 
private static <E> Set<E> getAllValuesFrom(KeySetIndexProxy<E> set) {
  return ImmutableSet.copyOf(set.iterator());
}
 
源代码9 项目: onos   文件: DistributedVirtualNetworkStore.java
@Override
public Set<TenantId> getTenantIds() {
    return ImmutableSet.copyOf(tenantIdSet);
}
 
源代码10 项目: buck   文件: NewNativeTargetProjectMutator.java
public NewNativeTargetProjectMutator setSourcesWithFlags(Set<SourceWithFlags> sourcesWithFlags) {
  this.sourcesWithFlags = ImmutableSet.copyOf(sourcesWithFlags);
  return this;
}
 
源代码11 项目: batfish   文件: CompletionMetadata.java
public @Nonnull Builder setStructureNames(Set<String> structureNames) {
  _structureNames = ImmutableSet.copyOf(structureNames);
  return this;
}
 
源代码12 项目: batfish   文件: InterfacesInterface.java
public void setBridgePorts(Set<String> bridgePorts) {
  _bridgePorts = ImmutableSet.copyOf(bridgePorts);
}
 
源代码13 项目: batfish   文件: ResolvedReachabilityParameters.java
public Builder setRequiredTransitNodes(Set<String> nodes) {
  _requiredTransitNodes = ImmutableSet.copyOf(nodes);
  return this;
}
 
源代码14 项目: j2cl   文件: MoreApt.java
/** Returns the list of the type and its super types without a specific order. */
public static ImmutableSet<TypeElement> getTypeHierarchy(TypeElement typeElement) {
  return ImmutableSet.copyOf(getHierarchyImpl(typeElement, true));
}
 
源代码15 项目: simpleretrogen   文件: WorldRetrogen.java
@EventHandler
public void serverAboutToStart(FMLServerAboutToStartEvent evt)
{
    this.pendingWork = new MapMaker().weakKeys().makeMap();
    this.completedWork = new MapMaker().weakKeys().makeMap();
    this.completedWorkLocks = new MapMaker().weakKeys().makeMap();

    Set<IWorldGenerator> worldGens = ObfuscationReflectionHelper.getPrivateValue(GameRegistry.class, null, "worldGenerators");
    Map<IWorldGenerator,Integer> worldGenIdx = ObfuscationReflectionHelper.getPrivateValue(GameRegistry.class, null, "worldGeneratorIndex");

    for (String retro : ImmutableSet.copyOf(retros.keySet()))
    {
        if (!delegates.containsKey(retro))
        {
            FMLLog.info("Substituting worldgenerator %s with delegate", retro);
            for (Iterator<IWorldGenerator> iterator = worldGens.iterator(); iterator.hasNext();)
            {
                IWorldGenerator wg = iterator.next();
                if (wg.getClass().getName().equals(retro))
                {
                    iterator.remove();
                    TargetWorldWrapper tww = new TargetWorldWrapper();
                    tww.delegate = wg;
                    tww.tag = retro;
                    worldGens.add(tww);
                    Integer idx = worldGenIdx.remove(wg);
                    worldGenIdx.put(tww, idx);
                    FMLLog.info("Successfully substituted %s with delegate", retro);
                    delegates.put(retro, tww);
                    break;
                }
            }

            if (!delegates.containsKey(retro))
            {
                FMLLog.warning("WorldRetrogen was not able to locate world generator class %s, it will be skipped, found %s", retro, worldGens);
                retros.remove(retro);
            }
        }
    }
}
 
源代码16 项目: batfish   文件: ResolvedReachabilityParameters.java
public Builder setFinalNodes(Set<String> finalNodes) {
  _finalNodes = ImmutableSet.copyOf(finalNodes);
  return this;
}
 
源代码17 项目: batfish   文件: Interface.java
public Builder setDependencies(@Nonnull Iterable<Dependency> dependencies) {
  _dependencies = ImmutableSet.copyOf(dependencies);
  return this;
}
 
源代码18 项目: presto   文件: StaticCatalogStore.java
public StaticCatalogStore(ConnectorManager connectorManager, File catalogConfigurationDir, List<String> disabledCatalogs)
{
    this.connectorManager = connectorManager;
    this.catalogConfigurationDir = catalogConfigurationDir;
    this.disabledCatalogs = ImmutableSet.copyOf(disabledCatalogs);
}
 
源代码19 项目: bazel   文件: AnalysisPhaseStartedEvent.java
/**
 * Construct the event.
 * @param targets The set of active targets that remain.
 */
public AnalysisPhaseStartedEvent(Collection<Target> targets) {
  this.targets = ImmutableSet.copyOf(targets);
}
 
源代码20 项目: yangtools   文件: YangInstanceIdentifier.java
/**
 * Construct new augmentation identifier using supplied set of possible
 * child nodes.
 *
 * @param childNames
 *            Set of possible child nodes.
 */
public AugmentationIdentifier(final Set<QName> childNames) {
    this.childNames = ImmutableSet.copyOf(childNames);
}