本文整理汇总了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;
}
示例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);
}
示例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