Interface GroupResult<K,T>

Type Parameters:
K - the type of the group key
T - the type of the grouped elements
All Superinterfaces:
Queryable<T>

public interface GroupResult<K,T> extends Queryable<T>
Represents a group result from a groupby...into clause. Extends Queryable to provide aggregate and query methods on the group's elements, with a key property for accessing the group key.
Since:
6.0.0
  • Method Details

    • getKey

      K getKey()
      Returns the group key. For single-key groupby, this is the raw key value. For multi-key groupby, this is a NamedRecord with named access.
      Returns:
      the group key
    • get

      Object get(String name)
      Returns a named component of the group key. Enables g.name property-style access and g.get("name") calls. For multi-key groupby, looks up the named component in the key record.
      Parameters:
      name - the key component name (from as alias in groupby)
      Returns:
      the value of the named key component
      Throws:
      UnsupportedOperationException - if this is a single-key group without aliases
    • getAt

      default Object getAt(String name)
      Subscript operator for accessing named key components. Enables g["name"] syntax.
      Parameters:
      name - the key component name
      Returns:
      the value of the named key component
    • of

      static <K, T> GroupResult<K,T> of(K key, Queryable<T> group)
      Factory method to create a GroupResult instance.
      Type Parameters:
      K - the type of the group key
      T - the type of the grouped elements
      Parameters:
      key - the group key
      group - the grouped elements as a Queryable
      Returns:
      a new GroupResult