Interface RecordStream<T>

Type Parameters:
T - the type parameter for the records in the stream
All Superinterfaces:
Iterable<T>
All Known Subinterfaces:
Cursor<T>, DocumentCursor

public interface RecordStream<T> extends Iterable<T>
An interface representing a stream of records of type T. Provides methods to create, manipulate and iterate over a stream of records.
Since:
1.0
Author:
Anindya Chatterjee.
  • Method Details

    • fromIterable

      static <T> RecordStream<T> fromIterable(Iterable<T> iterable)
      Creates a RecordStream from an Iterable.
      Type Parameters:
      T - the type parameter
      Parameters:
      iterable - the iterable
      Returns:
      the record stream
    • fromCombined

      static <T> RecordStream<T> fromCombined(Iterable<T> first, Iterable<T> second)
      Creates a RecordStream by combining two Iterables.
      Type Parameters:
      T - the type parameter
      Parameters:
      first - the first
      second - the second
      Returns:
      the record stream
    • except

      static <T> RecordStream<T> except(Iterable<T> iterable, Collection<T> elements)
      Creates a RecordStream by eliminating elements from an Iterable.
      Type Parameters:
      T - the type parameter
      Parameters:
      iterable - the iterable
      elements - the elements
      Returns:
      the record stream
    • empty

      static <V> RecordStream<V> empty()
      Creates an empty RecordStream.
      Type Parameters:
      V - the type parameter
      Returns:
      the record stream
    • single

      static <V> RecordStream<V> single(V v)
      Creates a RecordStream with a single element.
      Type Parameters:
      V - the type parameter
      Parameters:
      v - the v
      Returns:
      the record stream
    • size

      default long size()
      Gets the size of the RecordStream.
      Returns:
      the long
    • toList

      default List<T> toList()
      Creates a List from a RecordStream by iterating it.
      Returns:
      the list
    • toSet

      default Set<T> toSet()
      Creates a Set from a RecordStream by iterating it.
      Returns:
      the set
    • isEmpty

      default boolean isEmpty()
      Checks if this RecordStream has any elements or not.
      Returns:
      the boolean
    • firstOrNull

      default T firstOrNull()
      Gets the first element of the result or null if it is empty.
      Returns:
      the first element or null