本文整理了Java中ch.lambdaj.Lambda.convert()
方法的一些代码示例,展示了Lambda.convert()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lambda.convert()
方法的具体详情如下:
包路径:ch.lambdaj.Lambda
类名称:Lambda
方法名:convert
[英]Converts all the object in the iterable using the given Converter. 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.thucydides/thucydides-core
public <T> boolean matches(Collection<T> elements) {
List<Object> allFieldValues = convert(elements, new FieldValueExtractor());
Set<Object> uniquefieldValues = new HashSet<Object>();
uniquefieldValues.addAll(allFieldValues);
return (uniquefieldValues.size() == elements.size());
}
代码示例来源:origin: net.thucydides.plugins.jira/thucydides-jira-plugin
public List<NamedTestResult> getNamedTestResults() {
if (namedTestResults.isEmpty()) {
return Lists.newArrayList();
} else {
return convert(namedTestResults.entrySet(), fromMapEntriesToNamedTestResults());
}
}
代码示例来源:origin: mariofusco/lambdaj
/**
* Converts all the object in the iterable in its String representation.
* 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 {@link Lambda#forEach(Iterable)}.
* @param iterable The iterable containing the objects to be converted in strings
* @return A list containing the String representation of the objects in the given iterable
*/
public static List<String> extractString(Object iterable) {
return convert(iterable, new DefaultStringConverter());
}
代码示例来源:origin: mariofusco/lambdaj
/**
* Projects the objects in the given iterable by converting each of them in a set of key/value pairs.
* 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 {@link Lambda#forEach(Iterable)}.
* @param iterable The iterable containing the objects to be projected
* @param projectors The converters that define how each object should be projected
* @return A list of map where each map is the result of the projection of an object in the iterable
*/
public static <F> List<Map<String, Object>> project(Object iterable, Converter<F, Map.Entry<String, Object>>... projectors) {
return convert(iterable, new ProjectConverter<F>(projectors));
}
代码示例来源:origin: net.thucydides/thucydides-core
private List<Object> asList(String value) {
String listContents = StringUtils.removeEnd(StringUtils.removeStart(value,"["),"]");
List<String> items = Lists.newArrayList(Splitter.on(",").trimResults().split(listContents));
return convert(items, toObject());
}
代码示例来源:origin: net.thucydides/thucydides-core
public <T> boolean matches(Collection<T> elements) {
Comparable maximumValue = null;
try {
List<Comparable> fieldValues = convert(elements, toComparable());
maximumValue = max(fieldValues);
} catch (Exception e) {
throw new IllegalArgumentException("Could not find property value for " + fieldName);
}
return valueMatcher.matches(maximumValue);
}
代码示例来源:origin: net.thucydides/thucydides-core
public List<String> split(String chromeSwitches) {
CharMatcher trimmable = CharMatcher.anyOf(" ,;");
Splitter.on("--").trimResults().split(chromeSwitches);
List<String> options = Lists.newArrayList(Splitter.on("--").omitEmptyStrings().trimResults(trimmable).split(chromeSwitches));
return convert(options, withPrefixes());
}
代码示例来源:origin: net.serenity-bdd/core
private List<TestTag> expectedTags() {
String tagListValue = environmentVariables.getProperty(ThucydidesSystemProperty.TAGS);
if (StringUtils.isNotEmpty(tagListValue)) {
List<String> tagList = Lists.newArrayList(Splitter.on(",").trimResults().split(tagListValue));
return convert(tagList, fromStringValuesToTestTags());
} else {
return Lists.newArrayList();
}
}
代码示例来源:origin: net.thucydides/thucydides-core
@Override
public void describeTo(Description description) {
description.appendText("a collection of dates containing ");
List<String> dates = convert(expectedDates, toReadableForm());
description.appendText("[" + join(dates) + "]");
}
代码示例来源:origin: net.thucydides/thucydides-core
private void addTagsIfPresent(JsonDeserializationContext context, JsonObject outcomeJsonObject, TestOutcome testOutcome) {
Set<TestTag> tags = Sets.newHashSet(convert(context.deserialize(outcomeJsonObject.getAsJsonArray(TAGS), Set.class), toTags()));
if (tags != null) {
testOutcome.setTags(tags);
}
}
代码示例来源:origin: net.serenity-bdd/core
private void addTags(List<TestTag> tags, WithTags tagSet) {
if (tagSet != null) {
tags.addAll(convert(tagSet.value(), toTestTags()));
}
}
代码示例来源:origin: net.serenity-bdd/core
@Override
public void describeTo(Description description) {
description.appendText("a collection of dates containing ");
List<String> dates = convert(expectedDates, toReadableForm());
description.appendText("[" + join(dates) + "]");
}
代码示例来源:origin: net.serenity-bdd/serenity-jira-plugin
public TestResult getResultForIssue(final String issueNumber) {
List<T> testOutcomesForThisIssue = testOutcomesTally.get(issueNumber);
return TestResultList.overallResultFrom(convert(testOutcomesForThisIssue, toTestResults()));
}
代码示例来源:origin: net.thucydides/thucydides-core
private void addTagValues(List<TestTag> tags, WithTagValuesOf tagSet) {
if (tagSet != null) {
tags.addAll(convert(tagSet.value(), fromStringValuesToTestTags()));
}
}
代码示例来源:origin: net.serenity-bdd/core
private void addTagValues(List<TestTag> tags, WithTagValuesOf tagSet) {
if (tagSet != null) {
tags.addAll(convert(tagSet.value(), fromStringValuesToTestTags()));
}
}
代码示例来源:origin: net.serenity-bdd/core
public DataTableBuilder andMappedRows(List<? extends Map<String, ? extends Object>> mappedRows) {
List<List<Object>> rowData = Lists.newArrayList();
for (Map<String, ? extends Object> mappedRow : mappedRows) {
rowData.add(rowDataFrom(mappedRow));
}
return new DataTableBuilder(headers, convert(rowData, toDataTableRows()), title, description, descriptors);
}
代码示例来源:origin: net.thucydides/thucydides-core
public DataTableBuilder andMappedRows(List<? extends Map<String, ? extends Object>> mappedRows) {
List<List<Object>> rowData = Lists.newArrayList();
for (Map<String, ? extends Object> mappedRow : mappedRows) {
rowData.add(rowDataFrom(mappedRow));
}
return new DataTableBuilder(headers, convert(rowData, toDataTableRows()), title, description, descriptors);
}
代码示例来源:origin: net.serenity-bdd/core
@Override
public List<String> getSelectOptions() {
List<WebElement> results = Collections.emptyList();
if (getElement() != null) {
results = findElements(By.tagName("option"));
}
return convert(results, new ExtractText());
}
代码示例来源:origin: net.thucydides.plugins.jira/thucydides-jira-plugin
private SortedMap<String, NamedTestResult> findTestResults(List<String> commentLines) {
List<String> testResultLines = linesStartingAtRowIn(commentLines, FIRST_TEST_RESULT_LINE);
List<NamedTestResult> namedTestResults = convert(testResultLines, toNamedTestResults());
return indexByTestName(namedTestResults);
}
代码示例来源:origin: net.thucydides/thucydides-core
@Override
public List<String> getSelectOptions() {
List<WebElement> results = Collections.emptyList();
if (getElement() != null) {
results = getElement().findElements(By.tagName("option"));
}
return convert(results, new ExtractText());
}
内容来源于网络,如有侵权,请联系作者删除!