本文整理匯總了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);
}