当前位置: 首页>>代码示例>>Java>>正文


Java Iterables.addAll方法代码示例

本文整理汇总了Java中com.google.common.collect.Iterables.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java Iterables.addAll方法的具体用法?Java Iterables.addAll怎么用?Java Iterables.addAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.collect.Iterables的用法示例。


在下文中一共展示了Iterables.addAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: collectImplementedViews

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private static <T, D> Set<ModelType<?>> collectImplementedViews(ModelType<T> publicType, Iterable<? extends ModelType<?>> internalViewTypes, ModelType<D> delegateType) {
    final Set<ModelType<?>> viewsToImplement = Sets.newLinkedHashSet();
    viewsToImplement.add(publicType);
    Iterables.addAll(viewsToImplement, internalViewTypes);
    // TODO:LPTR This should be removed once BinaryContainer is a ModelMap
    // We need to also implement all the interfaces of the delegate type because otherwise
    // BinaryContainer won't recognize managed binaries as BinarySpecInternal
    if (delegateType != null) {
        walkTypeHierarchy(delegateType.getConcreteClass(), new TypeVisitor<D>() {
            @Override
            public void visitType(Class<? super D> type) {
                if (type.isInterface()) {
                    viewsToImplement.add(ModelType.of(type));
                }
            }
        });
    }
    return ModelTypes.collectHierarchy(viewsToImplement);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:DefaultStructBindingsStore.java

示例2: getSql

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
/**
 * @return the sql
 */
public List<String> getSql() {
  List<String> results = Lists.newLinkedList();
  if (!sql.isEmpty() || !upgradeScriptAdditions.isEmpty())
    results.addAll(initialisationSql);

  results.addAll(sql);

  for (UpgradeScriptAddition addition : upgradeScriptAdditions) {
    Iterables.addAll(results, addition.sql());
  }

  if (!results.isEmpty())
    results.addAll(finalisationSql);

  return Collections.unmodifiableList(results);
}
 
开发者ID:alfasoftware,项目名称:morf,代码行数:20,代码来源:UpgradePath.java

示例3: match

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Override
public void match(Platform platform, boolean requeueOnFailure, Function<Operation, Boolean> onMatch) {
  synchronized(queuedOperations) {
    ImmutableList.Builder<Operation> rejectedOperations = new ImmutableList.Builder<Operation>();
    boolean matched = false;
    while (!matched && !queuedOperations.isEmpty()) {
      Operation operation = queuedOperations.remove(0);
      if (satisfiesRequirements(platform, operation)) {
        matched = true;
        if (onMatch.apply(operation)) {
          onDispatched(operation);
        } else if (!requeueOnFailure) {
          rejectedOperations.add(operation);
        }
      } else {
        rejectedOperations.add(operation);
      }
    }
    Iterables.addAll(queuedOperations, rejectedOperations.build());
    if (!matched) {
      synchronized(workers) {
        workers.add(new Worker(platform, onMatch));
      }
    }
  }
}
 
开发者ID:bazelbuild,项目名称:bazel-buildfarm,代码行数:27,代码来源:MemoryInstance.java

示例4: matchOperation

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Override
protected boolean matchOperation(Operation operation) {
  ImmutableList.Builder<Worker> rejectedWorkers = new ImmutableList.Builder<>();
  boolean dispatched = false;
  synchronized(workers) {
    while (!dispatched && !workers.isEmpty()) {
      Worker worker = workers.remove(0);
      if (!satisfiesRequirements(worker.getPlatform(), operation)) {
        rejectedWorkers.add(worker);
      } else {
        // worker onMatch false return indicates inviability
        if (dispatched = worker.apply(operation)) {
          onDispatched(operation);
        }
      }
    }
    Iterables.addAll(workers, rejectedWorkers.build());
  }
  return dispatched;
}
 
开发者ID:bazelbuild,项目名称:bazel-buildfarm,代码行数:21,代码来源:MemoryInstance.java

示例5: getGeneratorMarkers

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Override
protected Map<OutputConfiguration, Iterable<IMarker>> getGeneratorMarkers(IProject builtProject,
		Collection<OutputConfiguration> outputConfigurations) throws CoreException {

	if (builtProject instanceof ExternalProject) {
		return emptyMap();
	}

	Map<OutputConfiguration, Iterable<IMarker>> generatorMarkers = newHashMap();
	for (OutputConfiguration config : outputConfigurations) {
		if (config.isCleanUpDerivedResources()) {
			List<IMarker> markers = Lists.newArrayList();
			for (IContainer container : getOutputs(builtProject, config)) {
				Iterables.addAll(
						markers,
						getDerivedResourceMarkers().findDerivedResourceMarkers(container,
								getGeneratorIdProvider().getGeneratorIdentifier()));
			}
			generatorMarkers.put(config, markers);
		}
	}
	return generatorMarkers;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:N4JSBuilderParticipant.java

示例6: pushUnsatisfiedDependencies

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private void pushUnsatisfiedDependencies(Iterable<? extends DefaultModelSchemaExtractionContext<?>> allDependencies, Queue<DefaultModelSchemaExtractionContext<?>> dependencyQueue, final ModelSchemaCache cache) {
    Iterables.addAll(dependencyQueue, Iterables.filter(allDependencies, new Predicate<ModelSchemaExtractionContext<?>>() {
        public boolean apply(ModelSchemaExtractionContext<?> dependency) {
            return cache.get(dependency.getType()) == null;
        }
    }));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:DefaultModelSchemaExtractor.java

示例7: collectHierarchy

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
/**
 * Collect all types that make up the type hierarchy of the given types.
 */
public static Set<ModelType<?>> collectHierarchy(Iterable<? extends ModelType<?>> types) {
    Queue<ModelType<?>> queue = new ArrayDeque<ModelType<?>>(Iterables.size(types) * 2);
    Iterables.addAll(queue, types);
    Set<ModelType<?>> seenTypes = Sets.newLinkedHashSet();
    ModelType<?> type;
    while ((type = queue.poll()) != null) {
        // Do not process Object's or GroovyObject's methods
        Class<?> rawClass = type.getRawClass();
        if (rawClass.equals(Object.class) || rawClass.equals(GroovyObject.class)) {
            continue;
        }
        // Do not reprocess
        if (!seenTypes.add(type)) {
            continue;
        }

        Class<?> superclass = rawClass.getSuperclass();
        if (superclass != null) {
            ModelType<?> superType = ModelType.of(superclass);
            if (!seenTypes.contains(superType)) {
                queue.add(superType);
            }
        }
        for (Class<?> iface : rawClass.getInterfaces()) {
            ModelType<?> ifaceType = ModelType.of(iface);
            if (!seenTypes.contains(ifaceType)) {
                queue.add(ifaceType);
            }
        }
    }

    return seenTypes;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:37,代码来源:ModelTypes.java

示例8: shardsWithState

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
public List<ShardRouting> shardsWithState(ShardRoutingState... state) {
    // TODO these are used on tests only - move into utils class
    List<ShardRouting> shards = new ArrayList<>();
    for (RoutingNode routingNode : this) {
        shards.addAll(routingNode.shardsWithState(state));
    }
    for (ShardRoutingState s : state) {
        if (s == ShardRoutingState.UNASSIGNED) {
            Iterables.addAll(shards, unassigned());
            break;
        }
    }
    return shards;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:RoutingNodes.java

示例9: getAllAnnotations

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<Annotation> getAllAnnotations() {
	final BasicEList<Annotation> result = XcoreCollectionLiterals.<Annotation>newBasicEList();
	final EObject parent = this.eContainer();
	if ((parent instanceof ExportDeclaration)) {
		EList<Annotation> _annotations = ((ExportDeclaration)parent).getAnnotations();
		Iterables.<Annotation>addAll(result, _annotations);
	}
	EList<Annotation> _annotations_1 = this.getAnnotations();
	Iterables.<Annotation>addAll(result, _annotations_1);
	return result;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:17,代码来源:PropertyAssignmentAnnotationListImpl.java

示例10: newVmCommandBuilder

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Override public VmCommandBuilder newVmCommandBuilder(Action action, File workingDirectory) {
    List<String> vmCommand = new ArrayList<String>();
    vmCommand.addAll(run.target.targetProcessPrefix(workingDirectory));
    vmCommand.add(run.getAndroidData());
    Iterables.addAll(vmCommand, run.invokeWith());
    vmCommand.add(run.vmCommand);

    // If you edit this, see also HostRuntime...
    VmCommandBuilder vmCommandBuilder = new VmCommandBuilder(run.log)
            .vmCommand(vmCommand)
            .vmArgs("-Duser.home=" + run.deviceUserHome)
            .maxLength(1024);
    if (modeId == ModeId.APP_PROCESS) {
        return vmCommandBuilder
            .vmArgs(action.getUserDir().getPath())
            .classpathViaProperty(true);
    }

    vmCommandBuilder
            .vmArgs("-Duser.name=" + run.target.getDeviceUserName())
            .vmArgs("-Duser.language=en")
            .vmArgs("-Duser.region=US");

    if (modeId == ModeId.DEVICE_ART_KITKAT) {
        // Required for KitKat to select the ART runtime. Default is Dalvik.
        vmCommandBuilder.vmArgs("-XXlib:libart.so");
    }
    if (!run.benchmark) {
        vmCommandBuilder.vmArgs("-Xverify:none");
        vmCommandBuilder.vmArgs("-Xdexopt:none");
        vmCommandBuilder.vmArgs("-Xcheck:jni");
    }
    // dalvikvm defaults to no limit, but the framework sets the limit at 2000.
    vmCommandBuilder.vmArgs("-Xjnigreflimit:2000");
    return vmCommandBuilder;
}
 
开发者ID:dryganets,项目名称:vogar,代码行数:37,代码来源:DeviceRuntime.java

示例11: updateOperationWatchers

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Override
protected void updateOperationWatchers(Operation operation) {
  synchronized(watchers) {
    List<Function<Operation, Boolean>> operationWatchers =
        watchers.get(operation.getName());
    if (operationWatchers != null) {
      if (operation.getDone()) {
        watchers.remove(operation.getName());
      }
      long unfilteredWatcherCount = operationWatchers.size();
      super.updateOperationWatchers(operation);
      ImmutableList.Builder<Function<Operation, Boolean>> filteredWatchers = new ImmutableList.Builder<>();
      long filteredWatcherCount = 0;
      for (Function<Operation, Boolean> watcher : operationWatchers) {
        if (watcher.apply(operation)) {
          filteredWatchers.add(watcher);
          filteredWatcherCount++;
        }
      }
      if (!operation.getDone() && filteredWatcherCount != unfilteredWatcherCount) {
        operationWatchers = new ArrayList<>();
        Iterables.addAll(operationWatchers, filteredWatchers.build());
        watchers.put(operation.getName(), operationWatchers);
      }
    } else {
      throw new IllegalStateException();
    }
  }
}
 
开发者ID:bazelbuild,项目名称:bazel-buildfarm,代码行数:30,代码来源:MemoryInstance.java

示例12: getInputs

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
public Iterable<NodeDef> getInputs(String name, String... ops){
	NodeDef nodeDef = getNodeDef(name);

	Collection<Trail> trails = new LinkedHashSet<>();

	collectInputs(new ArrayDeque<>(), nodeDef, new HashSet<>(Arrays.asList(ops)), trails);

	Function<Trail, NodeDef> function = new Function<Trail, NodeDef>(){

		@Override
		public NodeDef apply(Trail trail){
			return trail.getNodeDef();
		}
	};

	Collection<NodeDef> inputs = new LinkedHashSet<>();

	Iterables.addAll(inputs, Iterables.transform(trails, function));

	return inputs;
}
 
开发者ID:jpmml,项目名称:jpmml-tensorflow,代码行数:22,代码来源:SavedModel.java

示例13: write

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Override
public void write(Iterable<OFMessage> msglist) {
    Iterables.addAll(messages, msglist);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:5,代码来源:MockOFConnection.java

示例14: lookupProfiles

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Nonnull
@Override
public Promise<Map<UUID, Profile>> lookupProfiles(@Nonnull Iterable<UUID> uniqueIds) {
    Set<UUID> toFind = new HashSet<>();
    Iterables.addAll(toFind, uniqueIds);

    Map<UUID, Profile> ret = new HashMap<>();

    for (Iterator<UUID> iterator = toFind.iterator(); iterator.hasNext(); ) {
        UUID u = iterator.next();
        Profile profile = getProfile(u);
        if (profile.getName().isPresent()) {
            ret.put(u, profile);
            iterator.remove();
        }
    }

    StringBuilder sb = new StringBuilder("(");
    boolean first = true;
    for (UUID uniqueId : toFind) {
        if (uniqueId == null) {
            continue;
        }

        if (!first) {
            sb.append(", ");
        }
        sb.append("UNHEX(`").append(UuidUtils.toString(uniqueId)).append("`)");
        first = false;
    }

    if (first) {
        return Promise.completed(ret);
    }
    sb.append(")");

    return Scheduler.supplyAsync(() -> {
        try (Connection c = sql.getConnection()) {
            try (Statement s = c.createStatement()) {
                try (ResultSet rs = s.executeQuery(replaceTableName(String.format(SELECT_ALL_UIDS, sb.toString())))) {
                    while (rs.next()) {
                        String name = rs.getString("name");
                        Timestamp lastUpdate = rs.getTimestamp("lastupdate");
                        String uuidString = rs.getString("canonicalid");
                        UUID uuid = UuidUtils.fromString(uuidString);

                        ImmutableProfile p = new ImmutableProfile(uuid, name, lastUpdate.getTime());
                        updateCache(p);
                        ret.put(uuid, p);
                    }
                }
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return ret;
    });
}
 
开发者ID:lucko,项目名称:helper,代码行数:59,代码来源:ProfilesPlugin.java

示例15: visitParquetScanPrel

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private PrelWithDictionaryInfo visitParquetScanPrel(ParquetScanPrel parquetScanPrel, Void value) throws RuntimeException {
  final ReadDefinition readDefinition = parquetScanPrel.getTableMetadata().getReadDefinition();

  if (readDefinition == null || readDefinition.getExtendedProperty() == null) {
    return new PrelWithDictionaryInfo(parquetScanPrel);
  }

  // Make sure we don't apply global dictionary on columns that have conditions pushed into the scan
  final Set<String> columnsPushedToScan = new HashSet<>();
  if (parquetScanPrel.getConditions() != null) {
    Iterables.addAll(columnsPushedToScan, Iterables.transform(parquetScanPrel.getConditions(), FilterCondition.EXTRACT_COLUMN_NAME));
  }

  final Map<String, String> dictionaryEncodedColumnsToDictionaryFilePath = Maps.newHashMap();
  long dictionaryVersion = -1;

  final ParquetDatasetXAttr xAttr = ParquetDatasetXAttrSerDe.PARQUET_DATASET_XATTR_SERIALIZER.revert(
    readDefinition.getExtendedProperty().toByteArray());
  final DictionaryEncodedColumns dictionaryEncodedColumns = xAttr.getDictionaryEncodedColumns();
  if (dictionaryEncodedColumns != null) {
    dictionaryVersion = dictionaryEncodedColumns.getVersion();
    // Construct paths to dictionary files based on the version found in namespace. Do NOT look for files during planning.
    final Path dictionaryRootPath = new Path(dictionaryEncodedColumns.getRootPath());
    for (String dictionaryEncodedColumn : dictionaryEncodedColumns.getColumnsList()) {
      if (!columnsPushedToScan.contains(dictionaryEncodedColumn)) {
        dictionaryEncodedColumnsToDictionaryFilePath.put(dictionaryEncodedColumn,
          GlobalDictionaryBuilder.dictionaryFilePath(dictionaryRootPath, dictionaryEncodedColumn).toString());
      }
    }
  }

  if (dictionaryEncodedColumnsToDictionaryFilePath.isEmpty()) {
    return new PrelWithDictionaryInfo(parquetScanPrel);
  }

  final StoragePluginId storagePluginId = parquetScanPrel.getPluginId();
  boolean encodedColumns = false;
  final List<RelDataTypeField> newFields = Lists.newArrayList();
  final GlobalDictionaryFieldInfo[] fieldInfos = new GlobalDictionaryFieldInfo[parquetScanPrel.getRowType().getFieldCount()];
  final List<GlobalDictionaryFieldInfo> globalDictionaryColumns = Lists.newArrayList();

  for (int i = 0; i < parquetScanPrel.getRowType().getFieldCount(); ++i) {
    final RelDataTypeField field = parquetScanPrel.getRowType().getFieldList().get(i);
    if (dictionaryEncodedColumnsToDictionaryFilePath.containsKey(field.getName())) {
      fieldInfos[i] = new GlobalDictionaryFieldInfo(
        dictionaryVersion,
        field.getName(),
        storagePluginId,
        CompleteType.fromMinorType(TypeInferenceUtils.getMinorTypeFromCalciteType(field.getType())).getType(),
        dictionaryEncodedColumnsToDictionaryFilePath.get(field.getName()),
        new RelDataTypeFieldImpl(field.getName(), field.getIndex(), field.getType()));
      newFields.add(dictionaryEncodedField(field));
      globalDictionaryColumns.add(fieldInfos[i]);
      encodedColumns = true;
    } else {
      fieldInfos[i] = null;
      newFields.add(field);
    }
  }

  if (!encodedColumns) {
    return new PrelWithDictionaryInfo(parquetScanPrel);
  }

  final RelDataType newRelDataType = PrelWithDictionaryInfo.toRowDataType(newFields, parquetScanPrel.getCluster().getTypeFactory());
  final ParquetScanPrel newParquetScanPrel = parquetScanPrel.cloneWithGlobalDictionaryColumns(globalDictionaryColumns, newRelDataType);
  return new PrelWithDictionaryInfo(newParquetScanPrel, fieldInfos);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:69,代码来源:GlobalDictionaryVisitor.java


注:本文中的com.google.common.collect.Iterables.addAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。