/** * Sorts all the items in the given iterable on the respective values of the given 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 {@link Lambda#forEach(Iterable)}. * @param iterable The iterable of objects to be sorted * @param argument An argument defined using the {@link Lambda#on(Class)} method * @return A List with the same items of the given iterable sorted on the respective value of the given argument */ public static <T> List<T> sort(Object iterable, Object argument) { return sort(iterable, argument, 0); }
/** * Sorts all the items in the given iterable on the respective values of the given 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 {@link Lambda#forEach(Iterable)}. * @param iterable The iterable of objects to be sorted * @param argument An argument defined using the {@link Lambda#on(Class)} method * @param option Sorting option e.g.: DESCENDING + IGNORE_CASE * @return A List with the same items of the given iterable sorted on the respective value of the given argument */ public static <T> List<T> sort(Object iterable, Object argument, int option) { return sort(iterable, argument, getStandardComparator(option)); }
void doSort(Object argument) { setInner((Iterable<? extends T>)Lambda.sort(innerIterable, argument)); }
/** * @return The list of all of the different tag types that appear in the test outcomes. */ public List<String> getTagTypes() { Set<String> tagTypes = Sets.newHashSet(); for (TestOutcome outcome : outcomes) { addTagTypesFrom(outcome, tagTypes); } return sort(ImmutableList.copyOf(tagTypes), on(String.class)); }
/** * @return The list of all the names of the different tags in these test outcomes */ public List<String> getTagNames() { Set<String> tags = Sets.newHashSet(); for (TestOutcome outcome : outcomes) { addTagNamesFrom(outcome, tags); } return sort(ImmutableList.copyOf(tags), on(String.class)); }
public List<String> getFirstClassTagTypes() { Set<String> tagTypes = Sets.newHashSet(); for (TestOutcome outcome : outcomes) { addTagTypesFrom(outcome, tagTypes); } tagTypes.remove("version"); tagTypes.remove("feature"); tagTypes.remove("story"); tagTypes.removeAll(getRequirementTagTypes()); return sort(ImmutableList.copyOf(tagTypes), on(String.class)); }
/** * @return The list of all the names of the different tags in these test outcomes */ public List<String> getTagNames() { Set<String> tags = Sets.newHashSet(); for (TestOutcome outcome : outcomes) { addTagNamesFrom(outcome, tags); } return sort(ImmutableList.copyOf(tags), on(String.class)); }
/** * @return The list of all of the different tag types that appear in the test outcomes. */ public List<String> getTagTypes() { Set<String> tagTypes = Sets.newHashSet(); for (TestOutcome outcome : outcomes) { addTagTypesFrom(outcome, tagTypes); } return sort(ImmutableList.copyOf(tagTypes), on(String.class)); }
public List<String> getFirstClassTagTypes() { Set<String> tagTypes = Sets.newHashSet(); for (TestOutcome outcome : outcomes) { addTagTypesFrom(outcome, tagTypes); } tagTypes.remove("version"); tagTypes.removeAll(getRequirementTagTypes()); return sort(ImmutableList.copyOf(tagTypes), on(String.class)); }
/** * @return The list of all the tags associated with a given tag type. */ public List<TestTag> getTagsOfType(String tagType) { Set<TestTag> tags = Sets.newHashSet(); for (TestOutcome outcome : outcomes) { tags.addAll(tagsOfType(tagType).in(outcome)); } return sort(ImmutableList.copyOf(tags), on(String.class)); }
/** * @return The list of all the tags associated with a given tag type. */ public List<TestTag> getTagsOfType(String tagType) { Set<TestTag> tags = Sets.newHashSet(); for (TestOutcome outcome : outcomes) { tags.addAll(tagsOfType(tagType).in(outcome)); } return sort(ImmutableList.copyOf(tags), on(String.class)); }
/** * @return The list of TestOutcomes contained in this test outcome set. */ public List<? extends TestOutcome> getTests() { return sort(outcomes, on(TestOutcome.class).getTitle()); }
/** * @return The list of TestOutcomes contained in this test outcome set. */ public List<? extends TestOutcome> getTests() { return sort(outcomes, on(TestOutcome.class).getTitle()); }
/** * @return The list of all the tags associated with a given tag type. */ public List<TestTag> getMostSpecificTagsOfType(String tagType) { Set<TestTag> tags = Sets.newHashSet(); for (TestOutcome outcome : outcomes) { List<TestTag> mostSpecificOutcomeTags = removeGeneralTagsFrom(tagsOfType(tagType).in(outcome)); tags.addAll(mostSpecificOutcomeTags); } return sort(ImmutableList.copyOf(tags), on(String.class)); }
public String getFormattedIssues() { Set<String> issues = Sets.newHashSet(getIssues()); if (!issues.isEmpty()) { List<String> orderedIssues = sort(issues, on(String.class)); return "(" + getFormatter().addLinks(StringUtils.join(orderedIssues, ", ")) + ")"; } else { return ""; } }
/** * @return The list of all the tags associated with a given tag type. */ public List<TestTag> getMostSpecificTagsOfType(String tagType) { Set<TestTag> tags = Sets.newHashSet(); for (TestOutcome outcome : outcomes) { List<TestTag> mostSpecificOutcomeTags = removeGeneralTagsFrom(tagsOfType(tagType).in(outcome)); tags.addAll(mostSpecificOutcomeTags); } return sort(ImmutableList.copyOf(tags), on(String.class)); }
public String getFormattedIssues() { Set<String> issues = Sets.newHashSet(getIssues()); if (!issues.isEmpty()) { List<String> orderedIssues = sort(issues, on(String.class)); return "(" + getFormatter().addLinks(StringUtils.join(orderedIssues, ", ")) + ")"; } else { return ""; } }
public List<TestTag> getTagsOfTypeExcluding(String tagType, String excludedTag) { Set<TestTag> tags = Sets.newHashSet(); for (TestOutcome outcome : outcomes) { List<TestTag> allTagsOfType = removeGeneralTagsFrom(tagsOfType(tagType).in(outcome)); allTagsOfType = removeExcluded(allTagsOfType, excludedTag); tags.addAll(allTagsOfType); } return sort(ImmutableList.copyOf(tags), on(String.class)); }
public List<TestTag> getTagsOfTypeExcluding(String tagType, String excludedTag) { Set<TestTag> tags = Sets.newHashSet(); for (TestOutcome outcome : outcomes) { List<TestTag> allTagsOfType = removeGeneralTagsFrom(tagsOfType(tagType).in(outcome)); allTagsOfType = removeExcluded(allTagsOfType, excludedTag); tags.addAll(allTagsOfType); } return sort(ImmutableList.copyOf(tags), on(String.class)); }
public static List<AttributePathHelper> prepareAttributePathHelpers(final List<AttributePathHelper> attributePaths, final int level) { // only relevant attribute paths final List<AttributePathHelper> filteredAttributePaths = Lambda.filter( Lambda.having(Lambda.on(AttributePathHelper.class).length(), Matchers.greaterThanOrEqualTo(level)), attributePaths); if (filteredAttributePaths == null || filteredAttributePaths.isEmpty()) { return null; } // sort return Lambda.sort(filteredAttributePaths, Lambda.on(AttributePathHelper.class).length()); }