本文整理了Java中ch.lambdaj.Lambda.index()
方法的一些代码示例,展示了Lambda.index()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lambda.index()
方法的具体详情如下:
包路径:ch.lambdaj.Lambda
类名称:Lambda
方法名:index
[英]Indexes the objects in the given iterable based on the value of their argument. Actually it handles also Maps, Arrays and Iterator by collecting their values. Note that this method accepts an Object in order to be used in conjunction with the Lambda#forEach(Iterable).
[中]根据给定iterable中的对象的参数值对其进行索引。实际上,它还通过收集映射、数组和迭代器的值来处理它们。请注意,此方法接受一个对象,以便与Lambda#forEach(Iterable)一起使用。
代码示例来源:origin: net.serenity-bdd/serenity-jira-plugin
private SortedMap<String, NamedTestResult> indexByTestName(List<NamedTestResult> namedTestResults) {
Map<String, NamedTestResult> indexedTestResults = index(namedTestResults, on(NamedTestResult.class).getTestName());
SortedMap<String, NamedTestResult> sortedTestResults = Maps.newTreeMap();
sortedTestResults.putAll(indexedTestResults);
return sortedTestResults;
}
代码示例来源:origin: net.thucydides.plugins.jira/thucydides-jira-plugin
private SortedMap<String, NamedTestResult> indexByTestName(List<NamedTestResult> namedTestResults) {
Map<String, NamedTestResult> indexedTestResults = index(namedTestResults, on(NamedTestResult.class).getTestName());
SortedMap<String, NamedTestResult> sortedTestResults = Maps.newTreeMap();
sortedTestResults.putAll(indexedTestResults);
return sortedTestResults;
}
代码示例来源:origin: mariofusco/lambdaj
/**
* Indexes the objects in this iterable based on the value of their argument.
* @param argument An argument defined using the {@link Lambda#on(Class)} method
* @return A map having as keys the argument value extracted from the objects in the given iterable and as values the corresponding objects
*/
@SuppressWarnings("unchecked")
public <K> LambdaMap<K, T> map(K argument) {
return new LambdaMap<K, T>((Map<K, T>) Lambda.index(getInner(), argument));
}
代码示例来源:origin: mariofusco/lambdaj
/**
* Indexes the objects in this iterable based on the value of their argument.
* @param argument An argument defined using the {@link Lambda#on(Class)} method
* @return A map having as keys the argument value extracted from the objects in the given iterable and as values the corresponding objects
*/
public <A> LambdaMap<A, T> index(A argument) {
return new LambdaMap<A, T>((Map<A, T>)Lambda.index(getInner(), argument));
}
代码示例来源:origin: org.motechproject/motech-mobileforms-api
public void validate(FormBeanGroup formGroup, Map<String, FormValidator> validators, List<FormBean> allForms) {
try {
final List<FormBean> formBeansOrderedByPriority = formGroup.sortByDependency();
final Map<String, FormBean> formBeansIndexedByName = index(formBeansOrderedByPriority, on(FormBean.class).getFormname());
for (FormBean formBean : formBeansOrderedByPriority) {
final List<String> invalidDependentForms = getInvalidDependentForms(formBean, formBeansIndexedByName);
if (CollectionUtils.isEmpty(invalidDependentForms)) {
try {
formBean.addFormErrors(validators.get(formBean.getValidator()).validate(formBean, formGroup, allForms));
} catch (Exception e) {
formBean.addFormError(new FormError("Form Error:" + formBean.getFormname(), "Server exception, contact your administrator"));
log.error("Encountered exception while validating form group, " + formGroup.toString(), e);
}
} else {
formBean.addFormError(new FormError("Form Error:" + join(invalidDependentForms, ","), "Dependent form failed"));
}
}
} catch (Exception e) {
formGroup.markAllFormAsFailed("Server exception, contact your administrator");
log.error("Encountered exception while validating form group, " + formGroup.toString(), e);
}
}
内容来源于网络,如有侵权,请联系作者删除!