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

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

源代码1 项目: genie   文件: JobArchiveServiceImpl.java
/**
 * Constructor.
 *
 * @param jobArchivers             The ordered list of {@link JobArchiver} implementations to use. Not empty.
 * @param directoryManifestFactory The job directory manifest factory
 */
public JobArchiveServiceImpl(
    final List<JobArchiver> jobArchivers,
    final DirectoryManifest.Factory directoryManifestFactory
) {
    this.jobArchivers = ImmutableList.copyOf(jobArchivers);
    this.directoryManifestFactory = directoryManifestFactory;
}
 
源代码2 项目: judgels   文件: BlackboxGradingEngine.java
private void doAggregate() {
    MDC.put("gradingPhase", "AGGREGATE");
    LOGGER.info("Aggregation started.");
    ImmutableList.Builder<SubtaskVerdict> subtaskVerdictBuilder = ImmutableList.builder();
    for (Subtask subtask : config.getSubtasks()) {
        List<TestCaseVerdict> testCaseVerdicts =
                ImmutableList.copyOf(testCaseVerdictsBySubtaskIds.get(subtask.getId() + 1));
        AggregationResult aggregationResult =
                getAggregator().aggregate(testCaseVerdicts, subtask.getPoints());

        SubtaskVerdict subtaskVerdict = aggregationResult.getSubtaskVerdict();
        List<String> testCasePoints = aggregationResult.getTestCasePoints();

        subtaskVerdictBuilder.add(subtaskVerdict);

        for (int i = 0; i < testCaseVerdicts.size(); i++) {
            Integer[] testCaseIndices = testCaseIndicesBySubtaskIds.get(subtask.getId() + 1).get(i);
            int testGroupIndex = testCaseIndices[0];
            int testCaseIndex = testCaseIndices[1];
            String points = testCasePoints.get(i);
            testGroupPoints.get(testGroupIndex).set(testCaseIndex, points);
        }
    }

    subtaskVerdicts = subtaskVerdictBuilder.build();
    gradingVerdict = subtaskAggregator.aggregate(subtaskVerdictBuilder.build());
    LOGGER.info("Aggregation finished.");
}
 
源代码3 项目: presto   文件: TableScanNode.java
public TableScanNode(
        PlanNodeId id,
        TableHandle table,
        List<Symbol> outputs,
        Map<Symbol, ColumnHandle> assignments,
        TupleDomain<ColumnHandle> enforcedConstraint)
{
    super(id);
    this.table = requireNonNull(table, "table is null");
    this.outputSymbols = ImmutableList.copyOf(requireNonNull(outputs, "outputs is null"));
    this.assignments = ImmutableMap.copyOf(requireNonNull(assignments, "assignments is null"));
    checkArgument(assignments.keySet().containsAll(outputs), "assignments does not cover all of outputs");
    this.enforcedConstraint = requireNonNull(enforcedConstraint, "enforcedConstraint is null");
}
 
/**
 * Gets the immutable and sorted list of global server interceptors.
 *
 * @return The list of globally registered server interceptors.
 */
public ImmutableList<ClientInterceptor> getClientInterceptors() {
    if (this.sortedClientInterceptors == null) {
        List<ClientInterceptor> temp = Lists.newArrayList(this.clientInterceptors);
        sortInterceptors(temp);
        this.sortedClientInterceptors = ImmutableList.copyOf(temp);
    }
    return this.sortedClientInterceptors;
}
 
源代码5 项目: bazel   文件: LegacyIncludeScanner.java
/**
 * Constructs a new IncludeScanner
 *
 * @param cache externally scoped cache of file-path to inclusion-set mappings
 * @param pathCache include path existence cache
 * @param quoteIncludePaths the list of quote search path dirs (-iquote)
 * @param includePaths the list of all other non-framework search path dirs (-I and -isystem)
 * @param frameworkIncludePaths the list of framework other search path dirs (-F)
 */
LegacyIncludeScanner(
    IncludeParser parser,
    ExecutorService includePool,
    ConcurrentMap<Artifact, ListenableFuture<Collection<Inclusion>>> cache,
    PathExistenceCache pathCache,
    List<PathFragment> quoteIncludePaths,
    List<PathFragment> includePaths,
    List<PathFragment> frameworkIncludePaths,
    Path outputPath,
    Path execRoot,
    ArtifactFactory artifactFactory,
    Supplier<SpawnIncludeScanner> spawnIncludeScannerSupplier,
    boolean useAsyncIncludeScanner) {
  this.parser = parser;
  this.includePool = includePool;
  this.fileParseCache = cache;
  this.pathCache = pathCache;
  this.artifactFactory = Preconditions.checkNotNull(artifactFactory);
  this.spawnIncludeScannerSupplier = spawnIncludeScannerSupplier;
  this.quoteIncludePaths = ImmutableList.<PathFragment>builder()
      .addAll(quoteIncludePaths)
      .addAll(includePaths)
      .build();
  this.quoteIncludePathsFrameworkIndex = quoteIncludePaths.size();
  this.includePaths = ImmutableList.copyOf(includePaths);
  this.frameworkIncludePaths = ImmutableList.copyOf(frameworkIncludePaths);
  this.inclusionCache =
      useAsyncIncludeScanner ? new AsyncInclusionCache() : new LegacyInclusionCache();
  this.execRoot = execRoot;
  this.outputPathFragment = outputPath.relativeTo(execRoot);
  this.includeRootFragment =
      outputPathFragment.getRelative(BlazeDirectories.RELATIVE_INCLUDE_DIR);
  this.absoluteRoot = Root.absoluteRoot(execRoot.getFileSystem());
  this.useAsyncIncludeScanner = useAsyncIncludeScanner;
}
 
源代码6 项目: presto   文件: BenchmarkNodeScheduler.java
@Override
public NetworkLocation locate(HostAddress address)
{
    List<String> parts = new ArrayList<>(ImmutableList.copyOf(Splitter.on(".").split(address.getHostText())));
    Collections.reverse(parts);
    return new NetworkLocation(parts);
}
 
源代码7 项目: emodb   文件: RedundantDeltaTest.java
private List<UUID> toChangeIds(Iterator<Map.Entry<DeltaClusteringKey, Change>> iterator) {
    return ImmutableList.copyOf(
            Iterators.transform(iterator, entry -> entry.getKey().getChangeId()));
}
 
源代码8 项目: micro-server   文件: DataService.java
@Timed
public ImmutableList<Entity> findAll(String name){
	return ImmutableList.copyOf(searchByName(name));
	
}
 
源代码9 项目: netcdf-java   文件: AttributeContainerHelper.java
private AttributeContainerImmutable(String name, List<Attribute> atts) {
  this.name = name;
  this.atts = ImmutableList.copyOf(atts);
}
 
源代码10 项目: centraldogma   文件: MergedEntryDto.java
public MergedEntryDto(Revision revision, EntryType type, T content, Iterable<String> paths) {
    this.revision = requireNonNull(revision, "revision");
    this.type = requireNonNull(type, "type");
    this.content = requireNonNull(content, "content");
    this.paths = ImmutableList.copyOf(requireNonNull(paths, "paths"));
}
 
源代码11 项目: bazel   文件: IncludeScanning.java
@Nullable
@Override
public ListenableFuture<List<Artifact>> determineAdditionalInputs(
    @Nullable IncludeScannerSupplier includeScannerSupplier,
    CppCompileAction action,
    ActionExecutionContext actionExecutionContext,
    IncludeScanningHeaderData includeScanningHeaderData)
    throws ExecException, InterruptedException {
  // Return null when no include scanning occurs, as opposed to an empty set, to distinguish from
  // the case where includes are scanned but none are found.
  if (!action.shouldScanIncludes()) {
    return null;
  }

  Preconditions.checkNotNull(includeScannerSupplier, action);

  Set<Artifact> includes = Sets.newConcurrentHashSet();

  final List<PathFragment> absoluteBuiltInIncludeDirs = new ArrayList<>();
  includes.addAll(action.getBuiltInIncludeFiles());

  // Deduplicate include directories. This can occur especially with "built-in" and "system"
  // include directories because of the way we retrieve them. Duplicate include directories
  // really mess up #include_next directives.
  Set<PathFragment> includeDirs = new LinkedHashSet<>(action.getIncludeDirs());
  List<PathFragment> quoteIncludeDirs = action.getQuoteIncludeDirs();
  List<PathFragment> frameworkIncludeDirs = action.getFrameworkIncludeDirs();
  List<String> cmdlineIncludes = includeScanningHeaderData.getCmdlineIncludes();

  includeDirs.addAll(includeScanningHeaderData.getSystemIncludeDirs());

  // Add the system include paths to the list of include paths.
  for (PathFragment pathFragment : action.getBuiltInIncludeDirectories()) {
    if (pathFragment.isAbsolute()) {
      absoluteBuiltInIncludeDirs.add(pathFragment);
    }
    includeDirs.add(pathFragment);
  }

  List<PathFragment> includeDirList = ImmutableList.copyOf(includeDirs);
  IncludeScanner scanner =
      includeScannerSupplier.scannerFor(quoteIncludeDirs, includeDirList, frameworkIncludeDirs);

  Artifact mainSource = action.getMainIncludeScannerSource();
  Collection<Artifact> sources = action.getIncludeScannerSources();

  try (SilentCloseable c =
      Profiler.instance()
          .profile(ProfilerTask.SCANNER, action.getSourceFile().getExecPathString())) {
    ListenableFuture<?> future =
        scanner.processAsync(
            mainSource,
            sources,
            includeScanningHeaderData,
            cmdlineIncludes,
            includes,
            action,
            actionExecutionContext,
            action.getGrepIncludes());
    return Futures.transformAsync(
        future,
        new AsyncFunction<Object, List<Artifact>>() {
          @Override
          public ListenableFuture<List<Artifact>> apply(Object input) throws Exception {
            return Futures.immediateFuture(
                collect(actionExecutionContext, includes, absoluteBuiltInIncludeDirs));
          }
        },
        MoreExecutors.directExecutor());
  } catch (IOException e) {
    throw new EnvironmentalExecException(
        e, createFailureDetail("Include scanning IOException", Code.SCANNING_IO_EXCEPTION));
  }
}
 
源代码12 项目: ArchUnit   文件: JavaClassList.java
JavaClassList(List<JavaClass> elements) {
    this.elements = ImmutableList.copyOf(elements);
}
 
源代码13 项目: calcite   文件: RelMdCollation.java
public ImmutableList<RelCollation> collations(EnumerableCorrelate join,
    RelMetadataQuery mq) {
  return ImmutableList.copyOf(
      RelMdCollation.enumerableCorrelate(mq, join.getLeft(), join.getRight(),
          join.getJoinType()));
}
 
源代码14 项目: japicmp   文件: Options.java
public List<Filter> getIncludes() {
	return ImmutableList.copyOf(includes);
}
 
源代码15 项目: chvote-protocol-poc   文件: ShuffleProof.java
@Override
public Object[] elementsToHash() {
    return new Object[]{t_1, t_2, t_3, ImmutableList.copyOf(t_4), ImmutableList.copyOf(t_hat)};
}
 
源代码16 项目: grakn   文件: IndexQueryBuilder.java
public ImmutableList<Parameter<Order>> getOrders() {
    return ImmutableList.copyOf(orders);
}
 
源代码17 项目: armeria   文件: ExceptionInfo.java
/**
 * Creates a new instance.
 */
public ExceptionInfo(String name, Iterable<FieldInfo> fields, @Nullable String docString) {
    this.name = requireNonNull(name, "name");
    this.fields = ImmutableList.copyOf(requireNonNull(fields, "fields"));
    this.docString = Strings.emptyToNull(docString);
}
 
源代码18 项目: tracecompass   文件: StructDefinition.java
/**
 * Constructor This one takes the scope and thus speeds up definition
 * creation
 *
 * @param declaration
 *            the parent declaration
 * @param definitionScope
 *            the parent scope
 * @param scope
 *            the scope of this variable
 * @param structFieldName
 *            the field name
 * @param fieldNames
 *            the list of fields
 * @param definitions
 *            the definitions
 * @since 1.0
 */
public StructDefinition(@NonNull StructDeclaration declaration,
        IDefinitionScope definitionScope,
        @NonNull ILexicalScope scope,
        @NonNull String structFieldName,
        @NonNull Iterable<@NonNull String> fieldNames,
        Definition[] definitions) {
    super(declaration, definitionScope, structFieldName, scope);
    fFieldNames = ImmutableList.copyOf(fieldNames);
    fDefinitions = definitions;
    if (fFieldNames.isEmpty()) {
        fDefinitionsMap = Collections.emptyMap();
    }
}
 
源代码19 项目: tracecompass   文件: Attribute.java
/**
 * Get the list of child attributes below this one.
 *
 * @return The child attributes.
 */
public Iterable<Attribute> getSubAttributes() {
    return ImmutableList.copyOf(fSubAttributes.values());
}
 
源代码20 项目: calcite   文件: RelOptRuleCall.java
/**
 * Returns a list of matched relational expressions.
 *
 * @return matched relational expressions
 * @see #rel(int)
 */
public List<RelNode> getRelList() {
  return ImmutableList.copyOf(rels);
}