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


Java Iterables.contains方法代码示例

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


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

示例1: findLastMistaken

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private LastMistaken findLastMistaken(Collection<DtoModuleProcessingResult> results) {
    Function<DtoModuleProcessingResult, LastMistaken> extractLastMistakenFunction = extractingFunctionsProvider.getExtractLastMistakenFunction();
    Iterable<LastMistaken> lastMistakens = Iterables.transform(results, extractLastMistakenFunction);
    boolean containsAnyWrong = Iterables.contains(lastMistakens, LastMistaken.WRONG);
    boolean containsAnyCorrect = Iterables.contains(lastMistakens, LastMistaken.CORRECT);
    if (containsAnyWrong) {
        return LastMistaken.WRONG;
    } else if (containsAnyCorrect) {
        return LastMistaken.CORRECT;
    } else {
        return LastMistaken.NONE;
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:14,代码来源:ExpressionBeanResultsToResultVariableTransformation.java

示例2: MongoContext

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private MongoContext(final MongoClient client) {
  Preconditions.checkNotNull(client, "client");

  // allows to cleanup resources after each test
  final Closer closer = Closer.create();

  closer.register(new Closeable() {
    @Override
    public void close() throws IOException {
      client.close();
    }
  });

  // drop database if exists (to have a clean test)
  if (Iterables.contains(client.listDatabaseNames(), DBNAME)) {
    client.getDatabase(DBNAME).drop();
  }

  this.database = client.getDatabase(DBNAME);

  closer.register(new Closeable() {
    @Override
    public void close() throws IOException {
      database.drop();
    }
  });

  final ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());

  closer.register(new Closeable() {
    @Override
    public void close() throws IOException {
      MoreExecutors.shutdownAndAwaitTermination(executor, 100, TimeUnit.MILLISECONDS);
    }
  });

  this.setup = RepositorySetup.builder()
          .gson(createGson())
          .executor(executor)
          .database(database)
          .build();

  this.closer = closer;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:45,代码来源:MongoContext.java

示例3: messageOverrideMemberTypeConflict

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private void messageOverrideMemberTypeConflict(RedefinitionType redefinitionType, TMember overriding,
		TMember overridden, Result<Boolean> result, MemberMatrix mm) {

	String message;
	String code;
	String redefinitionTypeName = redefinitionType.name();
	if (redefinitionType == RedefinitionType.implemented &&
			Iterables.contains(mm.implemented(), overriding)) {
		redefinitionTypeName = "consumed";
	}

	String overridingSource = "";
	if (redefinitionType == RedefinitionType.implemented &&
			Iterables.contains(mm.inherited(), overriding)) {
		overridingSource = "inherited ";
	}

	String extraMessage = cfOtherImplementedMembers(mm, overriding, overridden);

	if (overriding.isField() && overridden.isField() && !((TField) overridden).isConst()) {
		code = CLF_REDEFINED_TYPE_NOT_SAME_TYPE;
		message = getMessageForCLF_REDEFINED_TYPE_NOT_SAME_TYPE(
				overridingSource + validatorMessageHelper.descriptionDifferentFrom(overriding, overridden),
				redefinitionTypeName,
				validatorMessageHelper.descriptionDifferentFrom(overridden, overriding),
				extraMessage);
	} else if (overriding.isMethod() && overridden.isMethod()) {
		code = CLF_REDEFINED_METHOD_TYPE_CONFLICT;

		message = getMessageForCLF_REDEFINED_METHOD_TYPE_CONFLICT(
				overridingSource + validatorMessageHelper.descriptionDifferentFrom(overriding, overridden),
				redefinitionTypeName,
				validatorMessageHelper.descriptionDifferentFrom(overridden, overriding),
				validatorMessageHelper.trimTypesystemMessage(result),
				extraMessage);
	} else {
		code = CLF_REDEFINED_MEMBER_TYPE_INVALID;
		message = getMessageForCLF_REDEFINED_MEMBER_TYPE_INVALID(
				overridingSource + validatorMessageHelper.descriptionDifferentFrom(overriding, overridden),
				validatorMessageHelper.descriptionDifferentFrom(overridden, overriding),
				redefinitionTypeName,
				validatorMessageHelper.trimTypesystemMessage(result),
				extraMessage);
	}

	addIssueToMemberOrInterfaceReference(redefinitionType, overriding, overridden, message, code);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:48,代码来源:N4JSMemberRedefinitionValidator.java

示例4: findDone

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private int findDone(Collection<DtoModuleProcessingResult> results) {
    Function<DtoModuleProcessingResult, Integer> extractDoneFunction = extractingFunctionsProvider.getExtractDoneFunction();
    Iterable<Integer> dones = Iterables.transform(results, extractDoneFunction);
    boolean atLeastOneIsNotDone = Iterables.contains(dones, 0);
    return atLeastOneIsNotDone ? 0 : EXPRESSION_TODO;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:7,代码来源:ExpressionBeanResultsToResultVariableTransformation.java

示例5: findErrors

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private int findErrors(Collection<DtoModuleProcessingResult> results) {
    Function<DtoModuleProcessingResult, Integer> extractErrorsFunction = extractingFunctionsProvider.getExtractErrorsFunction();
    Iterable<Integer> errors = Iterables.transform(results, extractErrorsFunction);
    boolean atLeastOneError = Iterables.contains(errors, 1);
    return atLeastOneError ? EXPRESSION_TODO : 0;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:7,代码来源:ExpressionBeanResultsToResultVariableTransformation.java


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