本文整理匯總了Java中com.google.common.collect.ImmutableList.Builder.addAll方法的典型用法代碼示例。如果您正苦於以下問題:Java Builder.addAll方法的具體用法?Java Builder.addAll怎麽用?Java Builder.addAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.ImmutableList.Builder
的用法示例。
在下文中一共展示了Builder.addAll方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: flatten
import com.google.common.collect.ImmutableList.Builder; //導入方法依賴的package包/類
private static List<Tokenizer> flatten(List<Tokenizer> simplifiers) {
Builder<Tokenizer> flattend = ImmutableList.builder();
for (Tokenizer s : simplifiers) {
if (s instanceof Recursive) {
// Tokenizers controls the creation of recursive tokenizers
// all recursive tokenizers are flat so we don't have
// to flatten recursively
final Recursive c = (Recursive) s;
flattend.addAll(c.getTokenizers());
} else {
flattend.add(s);
}
}
return flattend.build();
}
示例2: computeBranding
import com.google.common.collect.ImmutableList.Builder; //導入方法依賴的package包/類
public void computeBranding()
{
if (brandings == null)
{
Builder<String> brd = ImmutableList.builder();
brd.add(Loader.instance().getMCVersionString());
brd.add(Loader.instance().getMCPVersionString());
brd.add("Powered by Forge " + ForgeVersion.getVersion());
if (sidedDelegate!=null)
{
brd.addAll(sidedDelegate.getAdditionalBrandingInformation());
}
if (Loader.instance().getFMLBrandingProperties().containsKey("fmlbranding"))
{
brd.add(Loader.instance().getFMLBrandingProperties().get("fmlbranding"));
}
int tModCount = Loader.instance().getModList().size();
int aModCount = Loader.instance().getActiveModList().size();
brd.add(String.format("%d mod%s loaded, %d mod%s active", tModCount, tModCount!=1 ? "s" :"", aModCount, aModCount!=1 ? "s" :"" ));
brandings = brd.build();
brandingsNoMC = brandings.subList(1, brandings.size());
}
}
示例3: addTableFromStatements
import com.google.common.collect.ImmutableList.Builder; //導入方法依賴的package包/類
/**
* @see org.alfasoftware.morf.jdbc.SqlDialect#addTableFromStatements(org.alfasoftware.morf.metadata.Table, org.alfasoftware.morf.sql.SelectStatement)
*/
@Override
public Collection<String> addTableFromStatements(Table table, SelectStatement selectStatement) {
Builder<String> result = ImmutableList.<String>builder();
result.add(new StringBuilder()
.append(createTableStatement(table, true))
.append(" AS ")
.append(convertStatementToSQL(selectStatement))
.toString()
);
result.add("ALTER TABLE " + qualifiedTableName(table) + " NOPARALLEL LOGGING");
if (!primaryKeysForTable(table).isEmpty()) {
result.add("ALTER INDEX " + schemaNamePrefix() + primaryKeyConstraintName(table.getName()) + " NOPARALLEL LOGGING");
}
result.addAll(buildRemainingStatementsAndComments(table));
return result.build();
}
示例4: collectMappings
import com.google.common.collect.ImmutableList.Builder; //導入方法依賴的package包/類
private static Collection<SearchMapping> collectMappings(final Map<String, SearchMappings> searchMappings) {
final Builder<SearchMapping> builder = ImmutableList.builder();
// put the default mappings in first
final SearchMappings defaultMappings = searchMappings.get(DEFAULT);
if (defaultMappings != null) {
builder.addAll(defaultMappings.get());
}
// add the rest of the mappings
searchMappings.keySet().stream()
.filter(key -> !DEFAULT.equals(key))
.sorted()
.forEach(key -> builder.addAll(searchMappings.get(key).get()));
return builder.build();
}
示例5: modelToList
import com.google.common.collect.ImmutableList.Builder; //導入方法依賴的package包/類
@Override
protected ImmutableList<ValueAssignment> modelToList() {
Builder<ValueAssignment> out = ImmutableList.builder();
// Iterate through constants.
for (int constIdx = 0; constIdx < Native.modelGetNumConsts(z3context, model); constIdx++) {
long keyDecl = Native.modelGetConstDecl(z3context, model, constIdx);
Native.incRef(z3context, keyDecl);
out.addAll(getConstAssignments(keyDecl));
Native.decRef(z3context, keyDecl);
}
// Iterate through function applications.
for (int funcIdx = 0; funcIdx < Native.modelGetNumFuncs(z3context, model); funcIdx++) {
long funcDecl = Native.modelGetFuncDecl(z3context, model, funcIdx);
Native.incRef(z3context, funcDecl);
if (!isInternalSymbol(funcDecl)) {
String functionName = z3creator.symbolToString(Native.getDeclName(z3context, funcDecl));
out.addAll(getFunctionAssignments(funcDecl, funcDecl, functionName));
}
Native.decRef(z3context, funcDecl);
}
return out.build();
}
示例6: modelToList
import com.google.common.collect.ImmutableList.Builder; //導入方法依賴的package包/類
@Override
protected ImmutableList<ValueAssignment> modelToList() {
Builder<ValueAssignment> assignments = ImmutableList.builder();
long modelIterator = msat_model_create_iterator(model);
while (msat_model_iterator_has_next(modelIterator)) {
long[] key = new long[1];
long[] value = new long[1];
if (msat_model_iterator_next(modelIterator, key, value)) {
throw new NoSuchElementException();
}
if (msat_is_array_type(creator.getEnv(), msat_term_get_type(value[0]))) {
assignments.addAll(getArrayAssignments(key[0], key[0], value[0], Collections.emptyList()));
} else {
assignments.add(getAssignment(key[0], value[0]));
}
}
msat_destroy_model_iterator(modelIterator);
return assignments.build();
}
示例7: concat
import com.google.common.collect.ImmutableList.Builder; //導入方法依賴的package包/類
/**
* Concatenates two lists into a new GlobList. If either of the lists is a
* GlobList, its GlobCriteria are preserved. Otherwise a simple GlobCriteria
* is created to represent the fixed list.
*/
public static <T> GlobList<T> concat(
List<? extends T> list1, List<? extends T> list2) {
// we add the list to both includes and matches, preserving order
Builder<GlobCriteria> criteriaBuilder = ImmutableList.builder();
if (list1 instanceof GlobList<?>) {
criteriaBuilder.addAll(((GlobList<?>) list1).criteria);
} else {
criteriaBuilder.add(GlobCriteria.fromList(list1));
}
if (list2 instanceof GlobList<?>) {
criteriaBuilder.addAll(((GlobList<?>) list2).criteria);
} else {
criteriaBuilder.add(GlobCriteria.fromList(list2));
}
List<T> matches = ImmutableList.copyOf(Iterables.concat(list1, list2));
return new GlobList<>(criteriaBuilder.build(), matches);
}
示例8: getJavacOpts
import com.google.common.collect.ImmutableList.Builder; //導入方法依賴的package包/類
private ImmutableList<String> getJavacOpts(RuleContext ruleContext) {
Builder<String> javacopts = ImmutableList.builder();
String source = ruleContext.attributes().get("source_version", Type.STRING);
if (!isNullOrEmpty(source)) {
javacopts.add("-source").add(source);
}
String target = ruleContext.attributes().get("target_version", Type.STRING);
if (!isNullOrEmpty(target)) {
javacopts.add("-target").add(target);
}
String encoding = ruleContext.attributes().get("encoding", Type.STRING);
if (!isNullOrEmpty(encoding)) {
javacopts.add("-encoding", encoding);
}
List<String> xlint = ruleContext.attributes().get("xlint", Type.STRING_LIST);
if (!xlint.isEmpty()) {
javacopts.add("-Xlint:" + Joiner.on(",").join(xlint));
}
javacopts.addAll(ruleContext.getExpander().withDataLocations().tokenized("misc"));
javacopts.addAll(ruleContext.getExpander().withDataLocations().tokenized("javacopts"));
return javacopts.build();
}
示例9: interpret
import com.google.common.collect.ImmutableList.Builder; //導入方法依賴的package包/類
public double interpret( final SyntaxTree syntaxTree ) {
checkNotNull( syntaxTree, "Null syntax tree." );
final List<Token> tokens = syntaxTree.getTokens();
if ( tokens.size() == 1 ) {
final Token singleToken = getOnlyElement( tokens );
checkArgument( singleToken.getType().isLiteral() );
return (double) singleToken.getValue();
}
final int operationIndex = indexOfFirstOperation( tokens );
final Token operation = tokens.get( operationIndex );
final int leftOperandIndex = operationIndex - 2;
final Token leftOperand = tokens.get( leftOperandIndex );
final int rightOperandIndex = operationIndex - 1;
final Token rightOperand = tokens.get( rightOperandIndex );
final Token result = apply( operation, leftOperand, rightOperand );
final Builder<Token> resultantTokens = ImmutableList.<Token> builder()
.addAll( tokens.subList( 0, leftOperandIndex ) ).add( result );
if ( operationIndex + 1 < tokens.size() ) {
resultantTokens.addAll( tokens.subList( operationIndex + 1,
tokens.size() ) );
}
return interpret( SyntaxTree.create( resultantTokens.build() ) );
}
示例10: registerRpcListener
import com.google.common.collect.ImmutableList.Builder; //導入方法依賴的package包/類
@Override
public synchronized <T extends DOMRpcAvailabilityListener> ListenerRegistration<T> registerRpcListener(
final T listener) {
final Registration<T> ret = new Registration<>(this, listener, routingTable.getRpcs(listener));
final Builder<Registration<?>> b = ImmutableList.builder();
b.addAll(listeners);
b.add(ret);
listeners = b.build();
listenerNotifier.execute(ret::initialTable);
return ret;
}
示例11: tableDeploymentStatements
import com.google.common.collect.ImmutableList.Builder; //導入方法依賴的package包/類
/**
* When deploying a table need to ensure that an index doesn't already exist when creating it.
* @see org.alfasoftware.morf.jdbc.SqlDialect#tableDeploymentStatements(org.alfasoftware.morf.metadata.Table)
*/
@Override
public Collection<String> tableDeploymentStatements(Table table) {
Builder<String> statements = ImmutableList.<String>builder();
statements.addAll(internalTableDeploymentStatements(table));
for (Index index : table.indexes()) {
statements.add(optionalDropIndexStatement(table, index));
statements.add(indexDeploymentStatement(table, index));
}
return statements.build();
}
示例12: tableDeploymentStatements
import com.google.common.collect.ImmutableList.Builder; //導入方法依賴的package包/類
/**
* Creates SQL to deploy a database table and its associated indexes.
*
* @param table The meta data for the table to deploy.
* @return The statements required to deploy the table and its indexes.
*/
public Collection<String> tableDeploymentStatements(Table table) {
Builder<String> statements = ImmutableList.<String>builder();
statements.addAll(internalTableDeploymentStatements(table));
for (Index index : table.indexes()) {
statements.add(indexDeploymentStatement(table, index));
}
return statements.build();
}
示例13: computeBranding
import com.google.common.collect.ImmutableList.Builder; //導入方法依賴的package包/類
public void computeBranding()
{
if (brandings == null)
{
Builder<String> brd = ImmutableList.<String>builder();
brd.add(Loader.instance().getMCVersionString());
brd.add(Loader.instance().getMCPVersionString());
brd.add("FML v"+Loader.instance().getFMLVersionString());
String forgeBranding = (String) callForgeMethod("getBrandingVersion");
if (!Strings.isNullOrEmpty(forgeBranding))
{
brd.add(forgeBranding);
}
if (sidedDelegate!=null)
{
brd.addAll(sidedDelegate.getAdditionalBrandingInformation());
}
if (Loader.instance().getFMLBrandingProperties().containsKey("fmlbranding"))
{
brd.add(Loader.instance().getFMLBrandingProperties().get("fmlbranding"));
}
int tModCount = Loader.instance().getModList().size();
int aModCount = Loader.instance().getActiveModList().size();
brd.add(String.format("%d mod%s loaded, %d mod%s active", tModCount, tModCount!=1 ? "s" :"", aModCount, aModCount!=1 ? "s" :"" ));
brandings = brd.build();
brandingsNoMC = brandings.subList(1, brandings.size());
}
}
示例14: getChecks
import com.google.common.collect.ImmutableList.Builder; //導入方法依賴的package包/類
public static List<Class> getChecks() {
Builder<Class> builder = new ImmutableList.Builder<Class>();
//builder.addAll(getNodeChecks());
builder.addAll(getTopLevelChecks());
builder.addAll(getOtherChecks());
return builder.build();
}
示例15: getAllManuals
import com.google.common.collect.ImmutableList.Builder; //導入方法依賴的package包/類
@Override
public Collection<Sanction> getAllManuals() {
Builder<Sanction> builder = new ImmutableList.Builder<Sanction>();
builder.addAll(this.ip_manual);
builder.addAll(this.profile_manual);
return builder.build();
}