Interface GroupedQueriable<T>

All Superinterfaces:
Iterable<Group<T>>, Queriable<Group<T>>
All Known Subinterfaces:
OrderedGroupedQueriable<T>

public interface GroupedQueriable<T> extends Queriable<Group<T>>
Interface which allows easy chaining of the ListMatcher methods for grouped lists
Author:
René Bergelt
  • Method Details

    • get

      Queriable<T> get(GroupKey key)
      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
      Specified by:
      toList in interface Queriable<T>
      Returns:
      List of the elements ot this sequence
    • toMap

      Map<GroupKey,​Iterable<T>> 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

      GroupedQueriable<T> where(Predicate<Group<T>> predicate)
      Description copied from interface: Queriable
      Return all elements from the enumeration for which the predicate holds true or return an empty list if no such elements exist
      Specified by:
      where in interface Queriable<T>
      Parameters:
      predicate - The predicate to evaluate
      Returns:
      A queriable sequence of the elements which satisfy the given predicate
    • defaultIfEmpty

      GroupedQueriable<T> defaultIfEmpty(Group<T> defaultValue)
      Description copied from interface: Queriable
      Returns this enumeration itself if it contains any elements or if it is empty an enumeration only containing the given defaultElement
      Specified by:
      defaultIfEmpty in interface Queriable<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

      GroupedQueriable<T> concat(Iterable<Group<T>> toConcat)
      Description copied from interface: Queriable
      Return an enumeration which contains all elements of the current enumeration and all elements of the enumeration given as argument
      Specified by:
      concat in interface Queriable<T>
      Parameters:
      toConcat - Elements to concatenate
      Returns:
      A queriable sequence which contains the elements of this sequence and of the elements from toConcat
    • union

      GroupedQueriable<T> union(Iterable<Group<T>> toConcat)
      Description copied from interface: Queriable
      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 equals(...) method)
      Specified by:
      union in interface Queriable<T>
      Parameters:
      toConcat - Elements to unite with
      Returns:
      A queriable sequence which contains the union of this sequence and the given Iterable
    • union

      GroupedQueriable<T> union(Iterable<Group<T>> toConcat, Equivalence<Group<T>> equalityComparer)
      Description copied from interface: Queriable
      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)
      Specified by:
      union in interface Queriable<T>
      Parameters:
      toConcat - Elements to unite with
      equalityComparer - Comparer to determine if two elements are equal
      Returns:
      A queriable sequence which contains the union of this sequence and the given Iterable
    • intersect

      GroupedQueriable<T> intersect(Iterable<Group<T>> intersectWith)
      Description copied from interface: Queriable
      Returns an iterable which contains the elements of this enumeration which also exist in the given Iterable (Equality is checked using the equals(...) method)
      Specified by:
      intersect in interface Queriable<T>
      Parameters:
      intersectWith - Elements to intersect with
      Returns:
      A queriable sequence which contains the intersection of this sequence and the given Iterable
    • intersect

      GroupedQueriable<T> intersect(Iterable<Group<T>> intersectWith, Equivalence<Group<T>> equalityComparer)
      Description copied from interface: Queriable
      Returns an iterable which contains the elements of this enumeration which also exist in the given Iterable (Equality is checked using the given equalityComparer)
      Specified by:
      intersect in interface Queriable<T>
      Parameters:
      intersectWith - Elements to intersect with
      equalityComparer - Comparer to determine if two elements are equal
      Returns:
      A queriable sequence which contains the union of this sequence and the given Iterable
    • except

      GroupedQueriable<T> except(Iterable<Group<T>> elementsToSubtract)
      Description copied from interface: Queriable
      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)
      Specified by:
      except in interface Queriable<T>
      Parameters:
      elementsToSubtract - Elements to exclude
      Returns:
      A queriable sequence which contains only elements of this sequence which are not containedin the given Iterable
    • except

      GroupedQueriable<T> except(Iterable<Group<T>> elementsToSubtract, Equivalence<Group<T>> equalityComparer)
      Description copied from interface: Queriable
      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)
      Specified by:
      except in interface Queriable<T>
      Parameters:
      elementsToSubtract - Elements to exclude
      equalityComparer - Comparer to determine if two elements are equal
      Returns:
      A queriable sequence which contains only elements of this sequence which are not containedin the given Iterable
    • distinct

      GroupedQueriable<T> distinct()
      Description copied from interface: Queriable
      Returns an enumeration where each item of the enumeration appears exactly once (Equality is checked using the equals(...) method)
      Specified by:
      distinct in interface Queriable<T>
      Returns:
      all elements of this sequence without duplicates
    • distinct

      GroupedQueriable<T> distinct(Equivalence<Group<T>> equalityComparer)
      Description copied from interface: Queriable
      Returns an enumeration where each item of the enumeration appears exactly once (Equality is checked using the given equalityComparer)
      Specified by:
      distinct in interface Queriable<T>
      Parameters:
      equalityComparer - Comparer to determine if two elements are equal
      Returns:
      all elements of this sequence without duplicates
    • take

      GroupedQueriable<T> take(int amount)
      Description copied from interface: Queriable
      Take the given amount of elements from the enumeration or take elements until the enumeration ends
      Specified by:
      take in interface Queriable<T>
      Parameters:
      amount - max. amount of elements to take
      Returns:
      The first 'amount' of elements of this sequence (or less if fewer elements are present)
    • takeWhile

      GroupedQueriable<T> takeWhile(Predicate<Group<T>> condition)
      Description copied from interface: Queriable
      Take elements from the enumeration as long as they satisfy the condition or until the enumeration ends
      Specified by:
      takeWhile in interface Queriable<T>
      Parameters:
      condition - Condition to take an element
      Returns:
      The taken elements
    • skip

      GroupedQueriable<T> skip(int amount)
      Description copied from interface: Queriable
      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 elements
      Specified by:
      skip in interface Queriable<T>
      Parameters:
      amount - Number of elements to skip
      Returns:
      The elements of this sequence after the first 'amount' elements
    • skipWhile

      GroupedQueriable<T> skipWhile(Predicate<Group<T>> condition)
      Description copied from interface: Queriable
      Return 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
      Specified by:
      skipWhile in interface Queriable<T>
      Parameters:
      condition - skip condition
      Returns:
      The elements after the skipped elements
    • reverse

      GroupedQueriable<T> reverse()
      Description copied from interface: Queriable
      Reverse the order of elements of this enumeration
      Specified by:
      reverse in interface Queriable<T>
      Returns:
      A reversed sequence
    • orderBy

      Description copied from interface: Queriable
      Order the elements of this enumeration according to the values returned by the order function
      Specified by:
      orderBy in interface Queriable<T>
      Parameters:
      func - Function to retrieve the value to compare from an element
      Returns:
      The ordered elements
    • orderBy

      <TComparable> OrderedGroupedQueriable<T> orderBy(ItemFunc<Group<T>,​TComparable> valueFunc, Comparator<TComparable> comparator)
      Description copied from interface: Queriable
      Order the elements of this enumeration according to the values returned by the value function function using the given comparator
      Specified by:
      orderBy in interface Queriable<T>
      Type Parameters:
      TComparable - The type to compare with
      Parameters:
      valueFunc - Function to retrieve the value to compare from an element
      comparator - Comparator to compare values
      Returns:
      The ordered elements
    • orderByDescending

      OrderedGroupedQueriable<T> orderByDescending(ItemFunc<Group<T>,​Comparable> func)
      Description copied from interface: Queriable
      Order the elements of this enumeration according the values returned by the order function in descending order
      Specified by:
      orderByDescending in interface Queriable<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: Queriable
      Order the elements of this enumeration according to the values returned by the value function function using the given comparator in descending order
      Specified by:
      orderByDescending in interface Queriable<T>
      Type Parameters:
      TComparable - The type to compare with
      Parameters:
      valueFunc - Function to retrieve the value to compare from an element
      comparator - Comparator to compare values
      Returns:
      The ordered elements