本文整理汇总了Java中ch.lambdaj.collection.LambdaList类的典型用法代码示例。如果您正苦于以下问题:Java LambdaList类的具体用法?Java LambdaList怎么用?Java LambdaList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LambdaList类属于ch.lambdaj.collection包,在下文中一共展示了LambdaList类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkSubFile
import ch.lambdaj.collection.LambdaList; //导入依赖的package包/类
private boolean checkSubFile(CovariateFile knownCovariate, JsonCovariateFile configCovariate) {
List<CovariateSubFile> knownCovariateSubFiles = knownCovariate.getFiles();
List<JsonCovariateSubFile> configCovariateSubFiles = configCovariate.getSubFiles();
// The IDs of the sub files for this covariate must match the ones in the db
LambdaList<Integer> knownSubFileIds = with(knownCovariateSubFiles)
.extract(on(CovariateSubFile.class).getId());
LambdaList<Integer> configSubFileIds = with(configCovariateSubFiles)
.extract(on(JsonCovariateSubFile.class).getId());
if (!knownSubFileIds.equals(configSubFileIds)) {
return false;
}
// The file paths of the sub files for this covariate must match the ones in the db
LambdaList<String> knownSubFilePaths = with(knownCovariateSubFiles)
.extract(on(CovariateSubFile.class).getFile());
LambdaList<String> configSubFilePaths = with(configCovariateSubFiles)
.extract(on(JsonCovariateSubFile.class).getPath());
if (!knownSubFilePaths.equals(configSubFilePaths)) {
return false;
}
return true;
}
示例2: toList
import ch.lambdaj.collection.LambdaList; //导入依赖的package包/类
@Coercion
public LambdaList<Integer> toList(String input) {
String[] numbers = input.replace("[", "").replace("]", "").split(",");
return with(numbers).convert(new Converter<String, Integer>() {
public Integer convert(String from) {
return Integer.parseInt(from.trim());
}
});
}
示例3: matchesSafely
import ch.lambdaj.collection.LambdaList; //导入依赖的package包/类
@Override
protected boolean matchesSafely(List<? extends T> actual, Description mismatchDescription) {
LambdaList<Wrapper<T>> wrappedActual = with(actual).convert(wrap(actual, wrapperFactory));
LambdaList<Wrapper<T>> wrappedExpected = with(expected).convert(wrap(expected, wrapperFactory));
LambdaList<Wrapper<T>> inActualButNotInExpected = wrappedActual.clone().remove(isIn(wrappedExpected));
LambdaList<Wrapper<T>> inExpectedButNotInActual = wrappedExpected.clone().remove(isIn(wrappedActual));
appendMismatch(mismatchDescription, "In Actual but not in Expected", inActualButNotInExpected);
appendMismatch(mismatchDescription, "In Expected but not in Actual", inExpectedButNotInActual);
Matcher<Collection<? extends Wrapper<T>>> collectionMatcher = hasSameItemsAsCollection(
wrappedExpected.remove(not(isIn(wrappedActual)))
);
collectionMatcher.describeMismatch(wrappedActual.remove(not(isIn(wrappedExpected))), mismatchDescription);
int notsorted = 0;
if (sortcheck) {
LambdaList<Wrapper<T>> notCorrectlySorted = wrappedExpected.clone()
.remove(sortedEqual(wrappedActual));
appendMismatch(mismatchDescription, "Not sorted correctly",
notCorrectlySorted.convert(MismatchHelper.asStringWithFind(wrappedActual)).distinct());
notsorted = notCorrectlySorted.size();
}
return inActualButNotInExpected.size()
+ inExpectedButNotInActual.size()
+ notsorted == 0 && collectionMatcher.matches(wrappedActual);
}