程序包 amo.lib.linq

类 AbstractStream<T>

java.lang.Object
amo.lib.linq.AbstractStream<T>
所有已实现的接口:
Stream<T>, Iterable<T>
直接已知子类:
MapStream

public abstract class AbstractStream<T>
extends Object
implements Stream<T>
  • 构造器详细资料

  • 方法详细资料

    • reverseIterator

      protected Iterator<T> reverseIterator()
    • where

      public Stream<T> where​(Predicate<T> predicate)
      从接口复制的说明: Stream
      Filters a sequence of values based on a predicate.
      指定者:
      where 在接口中 Stream<T>
      参数:
      predicate - A function to test each element for a condition.
      返回:
      An Stream of type T that contains elements from the input sequence that satisfy the condition.
    • select

      public <R> Stream<R> select​(Selector<T,​R> selector)
      从接口复制的说明: Stream
      Projects each element of a sequence into a new form.
      指定者:
      select 在接口中 Stream<T>
      类型参数:
      R - The type of the value returned by selector.
      参数:
      selector - A transform function to apply to each element.
      返回:
      An Stream of type TResult whose elements are the result of invoking the transform function on each element of source.
    • find

      public T find​(Predicate<T> predicate)
      从接口复制的说明: Stream
      find目前使用的where,可以为find添加独立的Stream支持,找到一个equ时就终止next,修改where,在next时记录是否已经有匹配的,如果有了,hasnext返回 false,反正find就只返回一个
      指定者:
      find 在接口中 Stream<T>
      参数:
      predicate - predicate
      返回:
      An Stream of type T that equal elements from the input sequence that satisfy the condition.
    • findAll

      public List<T> findAll​(Predicate<T> predicate)
      指定者:
      findAll 在接口中 Stream<T>
    • groupBy

      public <K,​ E> Stream<Grouping<K,​E>> groupBy​(Selector<T,​K> keySelector, Selector<T,​E> elementSelector)
      从接口复制的说明: Stream
      Groups the elements of a sequence according to a specified key selector function.
      指定者:
      groupBy 在接口中 Stream<T>
      类型参数:
      K - The type of the key returned by keySelector.
      E - The type of the element returned by elementSelector.
      参数:
      keySelector - A function to extract the key for each source element.
      elementSelector - A function to map each source element to an element into a Grouping.
      返回:
      An Stream of type Grouping where each Grouping object contains a sequence of objects and a key (TKey, TResult respectively).
    • groupBy

      public <K> Stream<Grouping<K,​T>> groupBy​(Selector<T,​K> keySelector)
      从接口复制的说明: Stream
      Groups the elements of a sequence according to a specified key selector function.
      指定者:
      groupBy 在接口中 Stream<T>
      类型参数:
      K - The type of the key returned by keySelector.
      参数:
      keySelector - A function to extract the key for each source element.
      返回:
      An Stream of type Grouping where each Grouping object contains a sequence of objects and a key (TKey, TResult respectively).
    • orderBy

      public <R> OrderedStream<T> orderBy​(Selector<T,​R> keySelector, Comparator<R> comparator)
      从接口复制的说明: Stream
      Sorts the elements of a sequence in ascending order according to a key.
      指定者:
      orderBy 在接口中 Stream<T>
      类型参数:
      R - The type of the key returned by keySelector.
      参数:
      keySelector - A function to extract a key from an element.
      comparator - An Comparator to compare keys.
      返回:
      An Stream of type T whose elements are sorted according to a key.
    • orderBy

      public <R extends Comparable<R>> OrderedStream<T> orderBy​(Selector<T,​R> keySelector)
      从接口复制的说明: Stream
      Sorts the elements of a sequence in ascending order according to a key.
      指定者:
      orderBy 在接口中 Stream<T>
      类型参数:
      R - The type of the key returned by keySelector.
      参数:
      keySelector - A function to extract a key from an element.
      返回:
      An Stream of type T whose elements are sorted according to a key.
    • orderByDescending

      public <R> OrderedStream<T> orderByDescending​(Selector<T,​R> keySelector, Comparator<R> comparator)
      从接口复制的说明: Stream
      Sorts the elements of a sequence in descending order according to a key.
      指定者:
      orderByDescending 在接口中 Stream<T>
      类型参数:
      R - The type of the key returned by keySelector.
      参数:
      keySelector - A function to extract a key from an element.
      comparator - An Comparator to compare keys.
      返回:
      An Stream of type T whose elements are sorted according to a key.
    • orderByDescending

      public <R extends Comparable<R>> OrderedStream<T> orderByDescending​(Selector<T,​R> keySelector)
      从接口复制的说明: Stream
      Sorts the elements of a sequence in descending order according to a key.
      指定者:
      orderByDescending 在接口中 Stream<T>
      类型参数:
      R - The type of the key returned by keySelector.
      参数:
      keySelector - A function to extract a key from an element.
      返回:
      An Stream of type T whose elements are sorted according to a key.
    • aggregate

      public <R> R aggregate​(R seed, Aggregator<T,​R> aggregator)
      从接口复制的说明: Stream
      Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
      指定者:
      aggregate 在接口中 Stream<T>
      类型参数:
      R - The type of the accumulator value.
      参数:
      seed - The initial accumulator value.
      aggregator - An accumulator function to be invoked on each element.
      返回:
      The transformed final accumulator value.
    • take

      public Stream<T> take​(int count)
      从接口复制的说明: Stream
      Returns a specified number of contiguous elements from the start of a sequence.
      指定者:
      take 在接口中 Stream<T>
      参数:
      count - The number of elements to return.
      返回:
      An Stream of type T that contains the specified number of elements from the start of the input sequence.
    • skip

      public Stream<T> skip​(int count)
      从接口复制的说明: Stream
      Skips a specified number of contiguous elements from the start of a sequence then returns remaining elements.
      指定者:
      skip 在接口中 Stream<T>
      参数:
      count - The number of elements to skip.
      返回:
      An Stream of type T that contains the elements after the number of elements skipped from the start of the input sequence.
    • distinct

      public Stream<T> distinct()
      从接口复制的说明: Stream
      Returns distinct elements from a sequence by using the object equals() to compare values.
      指定者:
      distinct 在接口中 Stream<T>
      返回:
      An Stream of type T that contains distinct elements from the source sequence.
    • count

      public int count()
      从接口复制的说明: Stream
      Returns the number of elements in a sequence.
      指定者:
      count 在接口中 Stream<T>
      返回:
      The number of elements in the input sequence.
    • first

      public T first()
      从接口复制的说明: Stream
      Returns the first element of a sequence; this method throws an exception if the sequence is empty.
      指定者:
      first 在接口中 Stream<T>
      返回:
      The first element in the specified sequence.
    • first

      public T first​(Predicate<T> predicate)
      从接口复制的说明: Stream
      Returns the first element in a sequence that satisfies the specified condition; this method throws an exception if no element in the sequence satisfies the condition.
      指定者:
      first 在接口中 Stream<T>
      参数:
      predicate - A function to test each element for a condition.
      返回:
      The first element in the sequence that passes the test in the specified predicate function.
    • toList

      public List<T> toList()
      从接口复制的说明: Stream
      Creates a List from a Stream.
      指定者:
      toList 在接口中 Stream<T>
      返回:
      A List of type T that contains elements from the input sequence.