Interface GroupedQueriable<T>
- All Known Subinterfaces:
OrderedGroupedQueriable<T>
Interface which allows easy chaining of the ListMatcher methods
for grouped lists
- Author:
- René Bergelt
-
Method Summary
Modifier and TypeMethodDescriptionReturn an enumeration which contains all elements of the current enumeration and all elements of the enumeration given as argumentdefaultIfEmpty(Group<T> defaultValue)Returns this enumeration itself if it contains any elements or if it is empty an enumeration only containing the given defaultElementdistinct()Returns an enumeration where each item of the enumeration appears exactly once (Equality is checked using the equals(...) method)distinct(Equivalence<Group<T>> equalityComparer)Returns an enumeration where each item of the enumeration appears exactly once (Equality is checked using the given equalityComparer)Returns an iterable which contains only the elements of this enumeration which do not exist in the given Iterable (Equality is checked using the equals(...) method)Returns an iterable which contains only the elements of this enumeration which do not exist in the given Iterable (Equality is checked using the given equalityComparer)Return the elements of the group with the given group keysReturns an iterable which contains the elements of this enumeration which also exist in the given Iterable (Equality is checked using the equals(...) method)Returns an iterable which contains the elements of this enumeration which also exist in the given Iterable (Equality is checked using the given equalityComparer)orderBy(ItemFunc<Group<T>,Comparable> func)Order the elements of this enumeration according to the values returned by the order function<TComparable>
OrderedGroupedQueriable<T>orderBy(ItemFunc<Group<T>,TComparable> valueFunc, Comparator<TComparable> comparator)Order the elements of this enumeration according to the values returned by the value function function using the given comparatororderByDescending(ItemFunc<Group<T>,Comparable> func)Order the elements of this enumeration according the values returned by the order function in descending order<TComparable>
OrderedGroupedQueriable<T>orderByDescending(ItemFunc<Group<T>,TComparable> valueFunc, Comparator<TComparable> comparator)Order the elements of this enumeration according to the values returned by the value function function using the given comparator in descending orderreverse()Reverse the order of elements of this enumerationskip(int amount)Skip the given amount of elements in the list and return a Queriable which starts at the (amount+1)th element or is empty if the enumeration did not contain more than amount elementsReturn a queriable which starts at the first element of the enumeration which does not satisfy the condition, if no such element exists the returned Queriable is emptytake(int amount)Take the given amount of elements from the enumeration or take elements until the enumeration endsTake elements from the enumeration as long as they satisfy the condition or until the enumeration endstoList()Convert this grouped queriable to a grouped listtoMap()Convert this grouped queriable to a map where the keys are the groupkeys and the value is a iterable containing the group's itemsReturn an enumeration which contains all elements of the current enumeration and all elements of the enumeration given as argument without duplicates (Equality is checked using the equals(...) method)Return an enumeration which contains all elements of the current enumeration and all elements of the enumeration given as argument without duplicates (Equality is checked using the given equalityComparer)Return all elements from the enumeration for which the predicate holds true or return an empty list if no such elements existMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface de.renebergelt.quiterables.Queriable
all, average, average, cast, contains, contains, count, count, elementAt, elementAtOrDefault, elementAtOrDefault, exists, first, first, firstOrDefault, firstOrDefault, firstOrDefault, firstOrDefault, group, groupSingle, isEmpty, last, last, lastOrDefault, lastOrDefault, lastOrDefault, max, max, min, min, ofType, select, selectMany, sequenceEquals, sequenceEquals, single, single, singleOrDefault, singleOrDefault, sum, sum, toArray, toMap, toMap, toPrimitiveArray, toSet
-
Method Details
-
get
Return the elements of the group with the given group keys- Parameters:
key- Key of the group- Returns:
- Elements of the group
-
toList
GroupedList<T> toList()Convert this grouped queriable to a grouped list -
toMap
Convert this grouped queriable to a map where the keys are the groupkeys and the value is a iterable containing the group's items- Returns:
- Map of keys and elements
-
where
Description copied from interface:QueriableReturn all elements from the enumeration for which the predicate holds true or return an empty list if no such elements exist -
defaultIfEmpty
Description copied from interface:QueriableReturns this enumeration itself if it contains any elements or if it is empty an enumeration only containing the given defaultElement- Specified by:
defaultIfEmptyin interfaceQueriable<T>- Parameters:
defaultValue- The element to return if the enumeration is empty- Returns:
- this enumeration or an enumeration containing defaultValue if this is empty
-
concat
Description copied from interface:QueriableReturn an enumeration which contains all elements of the current enumeration and all elements of the enumeration given as argument -
union
Description copied from interface:QueriableReturn an enumeration which contains all elements of the current enumeration and all elements of the enumeration given as argument without duplicates (Equality is checked using the equals(...) method) -
union
Description copied from interface:QueriableReturn an enumeration which contains all elements of the current enumeration and all elements of the enumeration given as argument without duplicates (Equality is checked using the given equalityComparer) -
intersect
Description copied from interface:QueriableReturns an iterable which contains the elements of this enumeration which also exist in the given Iterable (Equality is checked using the equals(...) method) -
intersect
GroupedQueriable<T> intersect(Iterable<Group<T>> intersectWith, Equivalence<Group<T>> equalityComparer)Description copied from interface:QueriableReturns an iterable which contains the elements of this enumeration which also exist in the given Iterable (Equality is checked using the given equalityComparer) -
except
Description copied from interface:QueriableReturns an iterable which contains only the elements of this enumeration which do not exist in the given Iterable (Equality is checked using the equals(...) method) -
except
GroupedQueriable<T> except(Iterable<Group<T>> elementsToSubtract, Equivalence<Group<T>> equalityComparer)Description copied from interface:QueriableReturns an iterable which contains only the elements of this enumeration which do not exist in the given Iterable (Equality is checked using the given equalityComparer) -
distinct
GroupedQueriable<T> distinct()Description copied from interface:QueriableReturns an enumeration where each item of the enumeration appears exactly once (Equality is checked using the equals(...) method) -
distinct
Description copied from interface:QueriableReturns an enumeration where each item of the enumeration appears exactly once (Equality is checked using the given equalityComparer) -
take
Description copied from interface:QueriableTake the given amount of elements from the enumeration or take elements until the enumeration ends -
takeWhile
Description copied from interface:QueriableTake elements from the enumeration as long as they satisfy the condition or until the enumeration ends -
skip
Description copied from interface:QueriableSkip the given amount of elements in the list and return a Queriable which starts at the (amount+1)th element or is empty if the enumeration did not contain more than amount elements -
skipWhile
Description copied from interface:QueriableReturn a queriable which starts at the first element of the enumeration which does not satisfy the condition, if no such element exists the returned Queriable is empty -
reverse
GroupedQueriable<T> reverse()Description copied from interface:QueriableReverse the order of elements of this enumeration -
orderBy
Description copied from interface:QueriableOrder the elements of this enumeration according to the values returned by the order function -
orderBy
<TComparable> OrderedGroupedQueriable<T> orderBy(ItemFunc<Group<T>,TComparable> valueFunc, Comparator<TComparable> comparator)Description copied from interface:QueriableOrder the elements of this enumeration according to the values returned by the value function function using the given comparator -
orderByDescending
Description copied from interface:QueriableOrder the elements of this enumeration according the values returned by the order function in descending order- Specified by:
orderByDescendingin interfaceQueriable<T>- Parameters:
func- Function to retrieve the value to compare from an element- Returns:
- The ordered elements
-
orderByDescending
<TComparable> OrderedGroupedQueriable<T> orderByDescending(ItemFunc<Group<T>,TComparable> valueFunc, Comparator<TComparable> comparator)Description copied from interface:QueriableOrder the elements of this enumeration according to the values returned by the value function function using the given comparator in descending order- Specified by:
orderByDescendingin interfaceQueriable<T>- Type Parameters:
TComparable- The type to compare with- Parameters:
valueFunc- Function to retrieve the value to compare from an elementcomparator- Comparator to compare values- Returns:
- The ordered elements
-