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


Java ImmutableList.get方法代码示例

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


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

示例1: runTests

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
private static void runTests(
    AuthorityClassifier p,
    ImmutableMap<Classification, ImmutableList<String>> inputs) {

  Diagnostic.CollectingReceiver<UrlValue> cr = Diagnostic.CollectingReceiver.from(
      TestUtil.STDERR_RECEIVER);

  try {
    for (Map.Entry<Classification, ImmutableList<String>> e
        : inputs.entrySet()) {
      Classification want = e.getKey();
      ImmutableList<String> inputList = e.getValue();
      for (int i = 0; i < inputList.size(); ++i) {
        cr.clear();
        String url = inputList.get(i);
        UrlValue inp = UrlValue.from(TEST_URL_CONTEXT, url);
        Classification got = p.apply(inp, cr);
        assertEquals(i + ": " + url, want, got);
      }
      cr.clear();
    }
  } finally {
    cr.flush();
  }
}
 
开发者ID:OWASP,项目名称:url-classifier,代码行数:26,代码来源:AuthorityClassifierBuilderTest.java

示例2: main

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
public static void main(String... args) {

    Parser templateParser = Parboiled.createParser(Parser.class);
    ParsingResult<Object> result = new ReportingParseRunner<>(templateParser.Unit()).run(input2);

    ImmutableList<Object> copy = ImmutableList.copyOf(result.valueStack.iterator());

    if (!copy.isEmpty()) {
      Unit unit = (Unit) copy.get(0);

      Unit balance = Balancing.balance(unit);
      System.out.println(balance);
    }

    if (result.hasErrors()) {
      System.err.println(ErrorUtils.printParseErrors(result.parseErrors));
    }
    // System.out.println(ParseTreeUtils.printNodeTree(result));
  }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:RunParser.java

示例3: buildParamList

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
private Object[] buildParamList(Invokable<?, ?> invokable, int indexOfParamToSetToNull) {
  ImmutableList<Parameter> params = invokable.getParameters();
  Object[] args = new Object[params.size()];

  for (int i = 0; i < args.length; i++) {
    Parameter param = params.get(i);
    if (i != indexOfParamToSetToNull) {
      args[i] = getDefaultValue(param.getType());
      Assert.assertTrue(
          "Can't find or create a sample instance for type '"
              + param.getType()
              + "'; please provide one using NullPointerTester.setDefault()",
          args[i] != null || isNullable(param));
    }
  }
  return args;
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:18,代码来源:NullPointerTester.java

示例4: getNonnullReceiverFields

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
private Set<Element> getNonnullReceiverFields(NullnessStore<Nullness> nullnessResult) {
  Set<AccessPath> nonnullAccessPaths = nullnessResult.getAccessPathsWithValue(Nullness.NONNULL);
  Set<Element> result = new LinkedHashSet<>();
  for (AccessPath ap : nonnullAccessPaths) {
    if (ap.getRoot().isReceiver()) {
      ImmutableList<Element> elements = ap.getElements();
      if (elements.size() == 1) {
        Element elem = elements.get(0);
        if (elem.getKind().equals(ElementKind.FIELD)) {
          result.add(elem);
        }
      }
    }
  }
  return result;
}
 
开发者ID:uber,项目名称:NullAway,代码行数:17,代码来源:AccessPathNullnessAnalysis.java

示例5: drain

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
/**
 * Output any remaining tokens from the input stream (e.g. terminal whitespace).
 */
public final void drain() {
    int inputPosition = input.getText().length() + 1;
    if (inputPosition > this.inputPosition) {
        ImmutableList<? extends Token> tokens = input.getTokens();
        int tokensN = tokens.size();
        while (tokenI < tokensN && inputPosition > tokens.get(tokenI).getTok().getPosition()) {
            Token token = tokens.get(tokenI++);
            add(
                    Doc.Token.make(
                            token, Doc.Token.RealOrImaginary.IMAGINARY, ZERO, Optional.<Indent>absent()));
        }
    }
    this.inputPosition = inputPosition;
    checkClosed(0);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:19,代码来源:OpsBuilder.java

示例6: testGetParameterizedMartini

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
@SuppressWarnings("Guava")
@Test
public void testGetParameterizedMartini() throws NoSuchMethodException {
	String id = "Parameterized_Method_Calls:A_Parameterized_Case:25";
	Martini martini = getMartini(id);
	checkState(null != martini, "no Martini found matching ID [%s]", id);

	Map<Step, StepImplementation> stepIndex = martini.getStepIndex();
	Collection<StepImplementation> implementations = stepIndex.values();
	ImmutableList<StepImplementation> filtered = FluentIterable.from(implementations)
		.filter(notNull())
		.filter(Predicates.not(Predicates.instanceOf(UnimplementedStep.class)))
		.toList();
	assertFalse(filtered.isEmpty(), "expected at least one implementation");
	StepImplementation givenImplementation = filtered.get(0);

	Pattern pattern = givenImplementation.getPattern();
	assertNotNull(pattern, "expected implementation to have a Pattern");

	String regex = pattern.pattern();
	assertEquals(regex, "^a pre-existing condition known as \"(.+)\"$", "Pattern contains wrong regex");

	Method method = givenImplementation.getMethod();
	Method expected = ParameterizedTestSteps.class.getDeclaredMethod("aPreExistingConditionKnownAs", String.class);
	assertEquals(method, expected, "implementation contains wrong Method");
}
 
开发者ID:qas-guru,项目名称:martini-core,代码行数:27,代码来源:DefaultMixologistTest.java

示例7: findExpiredFiles

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
private Collection<StoreFile> findExpiredFiles(ImmutableList<StoreFile> stripe, long maxTs,
    List<StoreFile> filesCompacting, Collection<StoreFile> expiredStoreFiles) {
  // Order by seqnum is reversed.
  for (int i = 1; i < stripe.size(); ++i) {
    StoreFile sf = stripe.get(i);
    long fileTs = sf.getReader().getMaxTimestamp();
    if (fileTs < maxTs && !filesCompacting.contains(sf)) {
      LOG.info("Found an expired store file: " + sf.getPath()
          + " whose maxTimeStamp is " + fileTs + ", which is below " + maxTs);
      if (expiredStoreFiles == null) {
        expiredStoreFiles = new ArrayList<StoreFile>();
      }
      expiredStoreFiles.add(sf);
    }
  }
  return expiredStoreFiles;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:StripeStoreFileManager.java

示例8: everyCombinationOf

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
public static <T> void everyCombinationOf(Set<T> set, BiConsumer<T, T> consumer) {
	ImmutableList<T> asList = ImmutableList.copyOf(set);
	for (int l=0;(l+1)<asList.size();l++) {
		T left=asList.get(l);
		for (int r=l+1;r<asList.size();r++) {
			T right=asList.get(r);
			consumer.accept(left, right);
		}
	}
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:11,代码来源:Iterables.java

示例9: MultiModelState

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
public <M extends IModel, S extends IModelState> MultiModelState(ImmutableList<Pair<M, S>> states)
{
    ImmutableMap.Builder<MultiModelPart, S> builder = ImmutableMap.builder();
    for(int i = 0; i < states.size(); i++)
    {
        Pair<M, S> pair = states.get(i);
        builder.put(new MultiModelPart(pair.getLeft(), i), pair.getRight());
    }
    this.states = builder.build();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:11,代码来源:MultiModelState.java

示例10: execute

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
private MemgraphCypherScope execute(MemgraphCypherQueryContext ctx, CypherQuery cypherQuery) {
    MemgraphCypherScope scope = MemgraphCypherScope.newSingleItemScope(MemgraphCypherScope.newEmptyItem());
    ImmutableList<CypherClause> clauses = cypherQuery.getClauses();
    AtomicInteger clauseIndex = new AtomicInteger(0);
    for (; clauseIndex.intValue() < clauses.size(); clauseIndex.incrementAndGet()) {
        scope = execute(ctx, clauses, clauseIndex, scope);
    }
    if (clauses.get(clauses.size() - 1) instanceof CypherReturnClause) {
        return scope;
    }
    return MemgraphCypherScope.newEmpty();
}
 
开发者ID:mware-solutions,项目名称:memory-graph,代码行数:13,代码来源:QueryExecutor.java

示例11: buildTests

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
private void buildTests(ImmutableList<Attribute> candidates) {
    for (int i = 0; i < candidates.size(); i++) {
        Attribute candidateA = candidates.get(i);
        for (int j = i + 1; j < candidates.size(); j++) {
            Attribute candidateB = candidates.get(j);
            if (!tests.containsKey(candidateA.getColumnIdentifier())) {
                tests.put(candidateA.getColumnIdentifier(), new ArrayList<>());
            }
            tests.get(candidateA.getColumnIdentifier()).add(IndTest.fromAttributes(candidateA, candidateB));
            tests.get(candidateA.getColumnIdentifier()).add(IndTest.fromAttributes(candidateB, candidateA));
        }
    }
}
 
开发者ID:HPI-Information-Systems,项目名称:AdvancedDataProfilingSeminar,代码行数:14,代码来源:IndGraph.java

示例12: of

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
@Override
public Theme of(Path themeDirectory) {
	Function<Path, Maybe<PropertyTree>> path2Config = path -> PropertyTreeConfigs.propertyTreeOf(filetypeParserFactory, path);

	ImmutableList<PropertyTree> configs = Try.supplier(() -> Files.list(themeDirectory)
			.filter(p -> Filenames.filenameOf(p).startsWith("theme."))
			.map(path2Config)
			.flatMap(Maybe::asStream)
			.collect(ImmutableList.toImmutableList()))
			.mapCheckedException(RuntimeException::new)
			.get();

	if (configs.size() != 1) {
		throw new NotASolidSite(themeDirectory, filetypeParserFactory.supportedExtensions()
				.stream()
				.map(s -> "theme." + s)
				.collect(Collectors.toList()));
	}
	
	PropertyTree config = configs.get(0);
	Maybe<String> engine = config.find(String.class, "engine");
	if (engine.isPresent() && engine.get().equals("mustache")) {
		return new MustacheTheme(themeDirectory, config, markupRendererFactory);
	}
	if (engine.isPresent() && engine.get().equals("st")) {
		return new StringtemplateTheme(themeDirectory, config, markupRendererFactory);
	}
	if (engine.isPresent() && engine.get().equals("pebble")) {
		return new PebbleTheme(themeDirectory, config, markupRendererFactory);
	}

	throw new RuntimeException("theme engine not supported: "+config.prettyPrinted());
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:34,代码来源:DefaultThemeFactory.java

示例13: swapGroups

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
public void swapGroups(int groupOneIndex, int groupTwoIndex)
{
	ImmutableList<ControlGroup> groups = getGroups();
	ControlGroup controlOne = groups.get(groupOneIndex);
	ControlGroup controlTwo = groups.get(groupTwoIndex);
	removeGroup(groupOneIndex);
	addGroup(groupOneIndex, controlTwo);
	removeGroup(groupTwoIndex);
	addGroup(groupTwoIndex, controlOne);
	updateIndexes();
	validate();
}
 
开发者ID:equella,项目名称:Equella,代码行数:13,代码来源:CRepeater.java

示例14: updateIndexes

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
private void updateIndexes()
{
	ImmutableList<ControlGroup> groups = getGroups();
	for( int i = 0; i < groups.size(); i++ )
	{
		ControlGroup group = groups.get(i);
		group.setIndex(i);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:10,代码来源:CRepeater.java

示例15: loadFromDocument

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
@Override
public void loadFromDocument(PropBagEx itemxml)
{
	super.loadFromDocument(itemxml);

	final ImmutableList<ControlGroup> groups = getGroups();
	int nGroups = getGroupSize();
	for( int i = 0; i < nGroups; i++ )
	{
		Item oItem = items.get(i);
		ControlGroup vGroup = groups.get(i);

		loadGroup(vGroup, itemxml, !oItem.isSelected());
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:16,代码来源:CGroupCtrl.java


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