Documentation ¶
Overview ¶
A sequence of elements supporting sequential and parallel aggregate operations. The following example illustrates an aggregate operation using SEE java/util/stream/Stream.java
Index ¶
- func AllMatchFunc(s interface{}, f func(interface{}) bool) bool
- func AnyMatchFunc(s interface{}, f func(interface{}) bool) bool
- func ConcatFunc(s1, s2 interface{}) interface{}
- func CountFunc(s interface{}) int
- func DistinctFunc(s interface{}, f func(interface{}, interface{}) int) interface{}
- func DropUntilFunc(s interface{}, f func(interface{}) bool) interface{}
- func DropWhileFunc(s interface{}, f func(interface{}) bool) interface{}
- func EmptyFunc(s interface{}) interface{}
- func FilterFunc(s interface{}, f func(interface{}) bool) interface{}
- func FindAnyFunc(s interface{}, f func(interface{}) bool) interface{}
- func FindAnyIndexFunc(s interface{}, f func(interface{}) bool) int
- func FindFirstFunc(s interface{}, f func(interface{}) bool) interface{}
- func FindFirstIndexFunc(s interface{}, f func(interface{}) bool) int
- func ForEachFunc(s interface{}, f func(interface{}))
- func ForEachOrderedFunc(s interface{}, f func(interface{}))
- func LimitFunc(s interface{}, maxSize int) interface{}
- func MapFunc(s interface{}, f func(interface{}) interface{}) interface{}
- func MaxFunc(s interface{}, f func(interface{}, interface{}) int) interface{}
- func MinFunc(s interface{}, f func(interface{}, interface{}) int) interface{}
- func NoneMatchFunc(s interface{}, f func(interface{}) bool) bool
- func Of(obj interface{}) []interface{}
- func PeekFunc(s interface{}, f func(interface{})) interface{}
- func ReduceFunc(s interface{}, f func(left, right interface{}) interface{}) interface{}
- func SkipFunc(s interface{}, n int) interface{}
- func SortedFunc(s interface{}, f func(interface{}, interface{}) int) interface{}
- func TakeUntilFunc(s interface{}, f func(interface{}) bool) interface{}
- func TakeWhileFunc(s interface{}, f func(interface{}) bool) interface{}
- func ToSliceFunc(s interface{}) interface{}
- type MapPair
- type Stream
- func (stream *Stream) AllMatch(f func(interface{}) bool) bool
- func (stream *Stream) AnyMatch(f func(interface{}) bool) bool
- func (stream *Stream) Concat(s2 *Stream) *Stream
- func (stream *Stream) ConcatWithValue(v interface{}) *Stream
- func (stream *Stream) Count(ifStringAsRune ...bool) int
- func (stream *Stream) Distinct(f func(interface{}, interface{}) int) *Stream
- func (stream *Stream) DropUntil(f func(interface{}) bool) *Stream
- func (stream *Stream) DropWhile(f func(interface{}) bool) *Stream
- func (stream *Stream) Empty(ifStringAsRune ...bool) interface{}
- func (stream *Stream) Filter(f func(interface{}) bool) *Stream
- func (stream *Stream) FindAny(f func(interface{}) bool) optional.Optional
- func (stream *Stream) FindAnyIndex(f func(interface{}) bool) int
- func (stream *Stream) FindFirst(f func(interface{}) bool) optional.Optional
- func (stream *Stream) FindFirstIndex(f func(interface{}) bool) int
- func (stream *Stream) ForEach(f func(interface{}))
- func (stream *Stream) ForEachOrdered(f func(interface{}))
- func (stream *Stream) Length() int
- func (stream *Stream) Limit(maxSize int) *Stream
- func (stream *Stream) Map(f func(interface{}) interface{}) *Stream
- func (stream *Stream) Max(f func(interface{}, interface{}) int) optional.Optional
- func (stream *Stream) Min(f func(interface{}, interface{}) int) optional.Optional
- func (stream *Stream) NoneMatch(f func(interface{}) bool) bool
- func (stream *Stream) Of(ifStringAsRune ...bool) *Stream
- func (stream *Stream) Peek(f func(interface{})) *Stream
- func (stream *Stream) Reduce(f func(left, right interface{}) interface{}) optional.Optional
- func (stream *Stream) Size() int
- func (stream *Stream) Skip(n int) *Stream
- func (stream *Stream) Sorted(f func(interface{}, interface{}) int) *Stream
- func (stream *Stream) TakeUntil(f func(interface{}) bool) *Stream
- func (stream *Stream) TakeWhile(f func(interface{}) bool) *Stream
- func (stream *Stream) ToSlice(ifStringAsRune ...bool) interface{}
- func (stream *Stream) Value() interface{}
- func (stream *Stream) WithSlice(s interface{}) *Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllMatchFunc ¶
AllMatchFunc returns whether all elements of this stream match the provided predicate. May not evaluate the predicate on all elements if not necessary for determining the result. If the stream is empty then {@code true} is returned and the predicate is not evaluated.
func AnyMatchFunc ¶
AnyMatchFunc returns whether any elements of this stream match the provided predicate. May not evaluate the predicate on all elements if not necessary for determining the result. If the stream is empty then {@code false} is returned and the predicate is not evaluated.
func ConcatFunc ¶
func ConcatFunc(s1, s2 interface{}) interface{}
ConcatFunc creates a lazily concatenated stream whose elements are all the elements of the first stream followed by all the elements of the second stream. The resulting stream is ordered if both of the input streams are ordered, and parallel if either of the input streams is parallel. When the resulting stream is closed, the close handlers for both input streams are invoked.
func CountFunc ¶
func CountFunc(s interface{}) int
CountFunc returns the maximum element of this stream according to the provided.
func DistinctFunc ¶
func DistinctFunc(s interface{}, f func(interface{}, interface{}) int) interface{}
DistinctFunc returns a slice consisting of the distinct elements (according to {@link Object#equals(Object)}) of this slice.
func DropUntilFunc ¶
func DropUntilFunc(s interface{}, f func(interface{}) bool) interface{}
DropUntilFunc returns, if this slice is ordered, a slice consisting of the remaining elements of this slice after dropping the longest prefix of elements that match the given predicate. Otherwise returns, if this slice is unordered, a slice consisting of the remaining elements of this slice after dropping a subset of elements that match the given predicate.
func DropWhileFunc ¶
func DropWhileFunc(s interface{}, f func(interface{}) bool) interface{}
DropWhileFunc returns, if this slice is ordered, a slice consisting of the remaining elements of this slice after dropping the longest prefix of elements that match the given predicate. Otherwise returns, if this slice is unordered, a slice consisting of the remaining elements of this slice after dropping a subset of elements that match the given predicate.
func EmptyFunc ¶
func EmptyFunc(s interface{}) interface{}
EmptyFunc returns an empty sequential {@code slice}.
func FilterFunc ¶
func FilterFunc(s interface{}, f func(interface{}) bool) interface{}
FilterFunc returns a slice consisting of the elements of this slice that match the given predicate.
func FindAnyFunc ¶
func FindAnyFunc(s interface{}, f func(interface{}) bool) interface{}
FindAnyFunc returns an {@link Optional} describing some element of the stream, or an empty {@code Optional} if the stream is empty.
func FindAnyIndexFunc ¶
FindAnyFunc returns an {@link interface{}} describing some element of the stream, or an empty {@code Optional} if the stream is empty.
func FindFirstFunc ¶
func FindFirstFunc(s interface{}, f func(interface{}) bool) interface{}
FindFirstFunc returns an {@link Optional} describing the first element of this stream, or an empty {@code Optional} if the stream is empty. If the stream has no encounter order, then any element may be returned.
func FindFirstIndexFunc ¶
FindFirstFunc returns an {@link Optional} describing the first index of this stream, or an empty {@code Optional} if the stream is empty. If the stream has no encounter order, then any element may be returned.
func ForEachFunc ¶
func ForEachFunc(s interface{}, f func(interface{}))
ForEachFunc Performs an action for each element of this slice. <p>The behavior of this operation is explicitly nondeterministic. For parallel slice pipelines, this operation does <em>not</em> guarantee to respect the encounter order of the slice, as doing so would sacrifice the benefit of parallelism. For any given element, the action may be performed at whatever time and in whatever thread the library chooses. If the action accesses shared state, it is responsible for providing the required synchronization.
func ForEachOrderedFunc ¶
func ForEachOrderedFunc(s interface{}, f func(interface{}))
ForEachOrderedFunc Performs an action for each element of this slice. <p>This operation processes the elements one at a time, in encounter order if one exists. Performing the action for one element performing the action for subsequent elements, but for any given element, the action may be performed in whatever thread the library chooses.
func LimitFunc ¶
func LimitFunc(s interface{}, maxSize int) interface{}
LimitFunc Returns a slice consisting of the elements of this slice, truncated to be no longer than {@code maxSize} in length.
func MapFunc ¶
func MapFunc(s interface{}, f func(interface{}) interface{}) interface{}
MapFunc returns a slice consisting of the results of applying the given function to the elements of this slice.
func MaxFunc ¶
func MaxFunc(s interface{}, f func(interface{}, interface{}) int) interface{}
MaxFunc returns the maximum element of this stream according to the provided.
func MinFunc ¶
func MinFunc(s interface{}, f func(interface{}, interface{}) int) interface{}
MinFunc returns the minimum element of this stream according to the provided.
func NoneMatchFunc ¶
NoneMatchFunc returns whether no elements of this stream match the provided predicate. May not evaluate the predicate on all elements if not necessary for determining the result. If the stream is empty then {@code true} is returned and the predicate is not evaluated.
func Of ¶
func Of(obj interface{}) []interface{}
Of returns a slice consisting of the elements. obj: Accept Array、Slice、String(as []byte if ifStringAsRune else []rune)
func PeekFunc ¶
func PeekFunc(s interface{}, f func(interface{})) interface{}
PeekFunc returns a slice consisting of the elements of this slice, additionally performing the provided action on each element as elements are consumed from the resulting slice.
func ReduceFunc ¶
func ReduceFunc(s interface{}, f func(left, right interface{}) interface{}) interface{}
ReduceFunc calls a defined callback function on each element of an array, and returns an array that contains the results.
func SkipFunc ¶
func SkipFunc(s interface{}, n int) interface{}
SkipFunc returns a slice consisting of the remaining elements of this slice after discarding the first {@code n} elements of the slice. If this slice contains fewer than {@code n} elements then an empty slice will be returned.
func SortedFunc ¶
func SortedFunc(s interface{}, f func(interface{}, interface{}) int) interface{}
SortedFunc returns a slice consisting of the distinct elements (according to {@link Object#equals(Object)}) of this slice. s: Accept Array、Slice、String(as []byte if ifStringAsRune else []rune)
func TakeUntilFunc ¶
func TakeUntilFunc(s interface{}, f func(interface{}) bool) interface{}
TakeUntilFunc returns, if this slice is ordered, a slice consisting of the longest prefix of elements taken from this slice that unmatch the given predicate. Otherwise returns, if this slice is unordered, a slice consisting of a subset of elements taken from this slice that unmatch the given predicate.
func TakeWhileFunc ¶
func TakeWhileFunc(s interface{}, f func(interface{}) bool) interface{}
TakeWhileFunc returns, if this slice is ordered, a slice consisting of the longest prefix of elements taken from this slice that match the given predicate. Otherwise returns, if this slice is unordered, a slice consisting of a subset of elements taken from this slice that match the given predicate.
func ToSliceFunc ¶
func ToSliceFunc(s interface{}) interface{}
ToSliceFunc returns an array containing the elements of this stream.
Types ¶
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
func (*Stream) ConcatWithValue ¶
func (*Stream) FindAnyIndex ¶
func (*Stream) FindFirstIndex ¶
func (*Stream) ForEachOrdered ¶
func (stream *Stream) ForEachOrdered(f func(interface{}))
Source Files ¶
- allmatch.go
- anymatch.go
- concat.go
- count.go
- distinct.go
- doc.go
- dropuntil.go
- dropwhile.go
- empty.go
- filter.go
- findany.go
- findanyindex.go
- findfirst.go
- findfirstIndex.go
- foreach.go
- foreachordered.go
- limit.go
- map.go
- max.go
- min.go
- nonematch.go
- of.go
- peek.go
- reduce.go
- skip.go
- sorted.go
- stream.go
- string.go
- takeuntil.go
- takewhile.go
- toslice.go