Class ELStream<T>

java.lang.Object
io.micronaut.el.stream.ELStream<T>
Type Parameters:
T - The type of the elements, which the compiler knows from the source of the stream

@Internal public final class ELStream<T> extends Object
The Stream implementation class described in the section 2.3.3.1 of the Jakarta Expression Language specification.
Since:
1.0
Author:
Denis Stepanov
  • Method Details

    • of

      public static ELStream<Object> of(jakarta.el.ELContext context, Object source)
      Creates a stream from a Collection or a Java array.
      Parameters:
      context - The context
      source - The source of the stream
      Returns:
      The stream
    • filter

      public ELStream<T> filter(jakarta.el.LambdaExpression predicate)
      Parameters:
      predicate - The predicate
      Returns:
      A stream of the elements matching the predicate
    • filter

      public ELStream<T> filter(Predicate<? super T> predicate)
      Parameters:
      predicate - The predicate, as compiled from a lambda expression
      Returns:
      A stream of the elements matching the predicate
    • map

      public ELStream<Object> map(jakarta.el.LambdaExpression mapper)
      Parameters:
      mapper - The mapper
      Returns:
      A stream of the mapped elements
    • map

      public <R> ELStream<R> map(Function<? super T, ? extends R> mapper)
      Type Parameters:
      R - The type of the mapped elements
      Parameters:
      mapper - The mapper, as compiled from a lambda expression
      Returns:
      A stream of the mapped elements
    • flatMap

      public ELStream<Object> flatMap(jakarta.el.LambdaExpression mapper)
      Parameters:
      mapper - The mapper producing a stream for every element
      Returns:
      The concatenation of the mapped streams
    • flatMap

      public <R> ELStream<R> flatMap(Function<? super T, ?> mapper)
      Type Parameters:
      R - The type of the elements of the mapped streams
      Parameters:
      mapper - The mapper producing a stream for every element, as compiled from a lambda expression
      Returns:
      The concatenation of the mapped streams
    • distinct

      public ELStream<T> distinct()
      Returns:
      A stream of the distinct elements
    • sorted

      public ELStream<T> sorted()
      Returns:
      A stream of the elements sorted in their natural order
    • sorted

      public ELStream<T> sorted(jakarta.el.LambdaExpression comparator)
      Parameters:
      comparator - The comparator
      Returns:
      A stream of the elements sorted with the comparator
    • sorted

      public ELStream<T> sorted(Comparator<? super T> comparator)
      Parameters:
      comparator - The comparator, as compiled from a lambda expression
      Returns:
      A stream of the elements sorted with the comparator
    • forEach

      public @Nullable Object forEach(jakarta.el.LambdaExpression consumer)
      Parameters:
      consumer - The consumer invoked for every element
      Returns:
      Always null
    • forEach

      public @Nullable Object forEach(Consumer<? super T> consumer)
      Parameters:
      consumer - The consumer invoked for every element, as compiled from a lambda expression
      Returns:
      Always null
    • peek

      public ELStream<T> peek(jakarta.el.LambdaExpression consumer)
      Parameters:
      consumer - The consumer invoked for every element
      Returns:
      A stream of the same elements
    • peek

      public ELStream<T> peek(Consumer<? super T> consumer)
      Parameters:
      consumer - The consumer invoked for every element, as compiled from a lambda expression
      Returns:
      A stream of the same elements
    • iterator

      public Iterator<T> iterator()
      Returns:
      An iterator over the elements of the stream
    • limit

      public ELStream<T> limit(Object count)
      Parameters:
      count - The maximum number of elements
      Returns:
      A stream of at most count elements
    • substream

      public ELStream<T> substream(Object start)
      Parameters:
      start - The number of elements to skip
      Returns:
      A stream skipping the first elements
    • substream

      public ELStream<T> substream(Object start, Object end)
      Parameters:
      start - The number of elements to skip
      end - The exclusive end position
      Returns:
      A stream of the elements between the two positions
    • toArray

      public Object[] toArray()
      Returns:
      An array of the elements of the stream
    • toList

      public List<T> toList()
      Returns:
      A list of the elements of the stream
    • reduce

      public ELOptional<T> reduce(jakarta.el.LambdaExpression binaryOperator)
      Parameters:
      binaryOperator - The accumulator
      Returns:
      An optional holding the reduced value
    • reduce

      public ELOptional<T> reduce(BinaryOperator<T> binaryOperator)
      Parameters:
      binaryOperator - The accumulator, as compiled from a lambda expression
      Returns:
      An optional holding the reduced value
    • reduce

      public @Nullable Object reduce(@Nullable Object seed, jakarta.el.LambdaExpression binaryOperator)
      Parameters:
      seed - The seed
      binaryOperator - The accumulator
      Returns:
      The reduced value
    • reduce

      public @Nullable Object reduce(@Nullable Object seed, BinaryOperator<@Nullable Object> binaryOperator)
      Parameters:
      seed - The seed
      binaryOperator - The accumulator, as compiled from a lambda expression
      Returns:
      The reduced value
    • max

      public ELOptional<T> max()
      Returns:
      An optional holding the maximum element
    • max

      public ELOptional<T> max(jakarta.el.LambdaExpression comparator)
      Parameters:
      comparator - The comparator
      Returns:
      An optional holding the maximum element
    • max

      public ELOptional<T> max(Comparator<? super T> comparator)
      Parameters:
      comparator - The comparator, as compiled from a lambda expression
      Returns:
      An optional holding the maximum element
    • min

      public ELOptional<T> min()
      Returns:
      An optional holding the minimum element
    • min

      public ELOptional<T> min(jakarta.el.LambdaExpression comparator)
      Parameters:
      comparator - The comparator
      Returns:
      An optional holding the minimum element
    • min

      public ELOptional<T> min(Comparator<? super T> comparator)
      Parameters:
      comparator - The comparator, as compiled from a lambda expression
      Returns:
      An optional holding the minimum element
    • average

      public ELOptional<Object> average()
      Returns:
      An optional holding the average of the elements
    • sum

      public Object sum()
      Returns:
      The sum of the elements, zero for an empty stream
    • count

      public Long count()
      Returns:
      The number of elements of the stream
    • anyMatch

      public ELOptional<Boolean> anyMatch(jakarta.el.LambdaExpression predicate)
      Parameters:
      predicate - The predicate
      Returns:
      An optional holding true when any element matches, empty for an empty stream
    • anyMatch

      public ELOptional<Boolean> anyMatch(Predicate<? super T> predicate)
      Parameters:
      predicate - The predicate, as compiled from a lambda expression
      Returns:
      The same as anyMatch(LambdaExpression)
    • allMatch

      public ELOptional<Boolean> allMatch(jakarta.el.LambdaExpression predicate)
      Parameters:
      predicate - The predicate
      Returns:
      An optional holding true when all the elements match, empty for an empty stream
    • allMatch

      public ELOptional<Boolean> allMatch(Predicate<? super T> predicate)
      Parameters:
      predicate - The predicate, as compiled from a lambda expression
      Returns:
      The same as allMatch(LambdaExpression)
    • noneMatch

      public ELOptional<Boolean> noneMatch(jakarta.el.LambdaExpression predicate)
      Parameters:
      predicate - The predicate
      Returns:
      An optional holding true when no element matches, empty for an empty stream
    • noneMatch

      public ELOptional<Boolean> noneMatch(Predicate<? super T> predicate)
      Parameters:
      predicate - The predicate, as compiled from a lambda expression
      Returns:
      The same as noneMatch(LambdaExpression)
    • findFirst

      public ELOptional<T> findFirst()
      Returns:
      An optional holding the first element of the stream
    • invokeOperation

      public @Nullable Object invokeOperation(String name, Object[] arguments)
      Invokes one of the operations of this class, avoiding the reflective dispatch of the standard resolvers.
      Parameters:
      name - The name of the operation
      arguments - The arguments
      Returns:
      The result of the operation