java.lang.Object
org.jooq.lambda.WindowImpl<T>
- All Implemented Interfaces:
Collectable<T>
,Window<T>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWindowImpl
(Tuple2<T, Long> value, Partition<T> partition, WindowSpecification<T> specification) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Whether all elements in the collectable match a given predicate.boolean
Whether any element in the collectable matches a given predicate.avg()
Get the average of the elements in this collectable.<U> Optional
<U> Get the average of the elements in this collectable.double
avgDouble
(ToDoubleFunction<? super T> function) Get the average of the elements in this collectable asdouble
.double
avgInt
(ToIntFunction<? super T> function) Get the average of the elements in this collectable asint
.double
avgLong
(ToLongFunction<? super T> function) Get the average of the elements in this collectable aslong
.bitAnd()
Collect all bits in this stream into a single value by applying bitwise and.<U> Optional
<U> Collect all bits in this stream into a single value by applying bitwise and.int
bitAndInt
(ToIntFunction<? super T> function) Collect all bits in this stream into a single value by applying bitwise and.long
bitAndLong
(ToLongFunction<? super T> function) Collect all bits in this stream into a single value by applying bitwise and.bitOr()
Collect all bits in this stream into a single value by applying bitwise or.<U> Optional
<U> Collect all bits in this stream into a single value by applying bitwise or.int
bitOrInt
(ToIntFunction<? super T> function) Collect all bits in this stream into a single value by applying bitwise or.long
bitOrLong
(ToLongFunction<? super T> function) Collect all bits in this stream into a single value by applying bitwise or.<R,
A> R Collect this collectable.Get the common prefix of all strings (or to-stringed values) in this stream.Get the common prefix of all strings (or to-stringed values) in this stream.private boolean
long
count()
Count the values in this collectable.long
Count the values in this collectable, for which a predicate evaluates to true.long
Count the distinct values in this collectable.long
countDistinct
(Predicate<? super T> predicate) Count the distinct values in this collectable, for which a predicate evaluates to true.<U> long
countDistinctBy
(Function<? super T, ? extends U> function) Count the distinct values of a given expression in this collectable.<U> long
countDistinctBy
(Function<? super T, ? extends U> function, Predicate<? super U> predicate) Count the distinct values of a given expression in this collectable, for which a predicate evaluates to true.long
The dense rank of the current row within the partition.The first value in the window.<U> Optional
<U> firstValue
(Function<? super T, ? extends U> function) The first value in the window.lag()
The previous value in the window.lag
(long lag) The previous value bylag
in the window.The last value in the window.<U> Optional
<U> The last value in the window.lead()
The next value in the window.lead
(long lead) The next value bylead
in the window.lead0
(long lead) private int
lower()
private boolean
max()
Get the maximum value.max
(Comparator<? super T> comparator) Get the maximum value by a function.<U extends Comparable<? super U>>
Optional<U> Get the maximum value by a function.<U> Optional
<U> max
(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Get the maximum value by a function.maxAll()
Get the maximum values.maxAll
(Comparator<? super T> comparator) Get the maximum values by a function.<U extends Comparable<? super U>>
Seq<U> Get the maximum values by a function.<U> Seq
<U> maxAll
(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Get the maximum values by a function.<U extends Comparable<? super U>>
Seq<T> Get the maximum values by a function.maxAllBy
(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Get the maximum values by a function.<U extends Comparable<? super U>>
Optional<T> Get the maximum value by a function.maxBy
(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Get the maximum value by a function.median()
Get the median value.median
(Comparator<? super T> comparator) Get the median value.<U extends Comparable<? super U>>
Optional<T> Get the median value by a function.medianBy
(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Get the median value by a function.min()
Get the minimum value.min
(Comparator<? super T> comparator) Get the minimum value by a function.<U extends Comparable<? super U>>
Optional<U> Get the minimum value by a function.<U> Optional
<U> min
(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Get the minimum value by a function.minAll()
Get the minimum values.minAll
(Comparator<? super T> comparator) Get the minimum values by a function.<U extends Comparable<? super U>>
Seq<U> Get the minimum values by a function.<U> Seq
<U> minAll
(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Get the minimum values by a function.<U extends Comparable<? super U>>
Seq<T> Get the minimum values by a function.minAllBy
(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Get the minimum values by a function.<U extends Comparable<? super U>>
Optional<T> Get the minimum value by a function.minBy
(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Get the minimum value by a function.mode()
Get the mode, i.e.modeAll()
Get the mode, i.e.Get the mode, i.e.Get the mode, i.e.boolean
Whether no element in the collectable matches a given predicate.nthValue
(long n) The nth value in the window.<U> Optional
<U> The nth value in the window.long
ntile
(long bucket) The bucket number ("ntile") of the current row within the partition.percentile
(double percentile) Get the discrete percentile value.percentile
(double percentile, Comparator<? super T> comparator) Get the discrete percentile value.<U extends Comparable<? super U>>
Optional<T> percentileBy
(double percentile, Function<? super T, ? extends U> function) Get the discrete percentile value by a function.percentileBy
(double percentile, Function<? super T, ? extends U> function, Comparator<? super U> comparator) Get the discrete percentile value by a function.double
The precent rank of the current row within the partition.long
rank()
The rank of the current row within the partition.long
The row number of the current row within the partition.sum()
Get the sum of the elements in this collectable.<U> Optional
<U> Get the sum of the elements in this collectable.double
sumDouble
(ToDoubleFunction<? super T> function) Get the sum of the elements in this collectable asdouble
.int
sumInt
(ToIntFunction<? super T> function) Get the sum of the elements in this collectable asint
.long
sumLong
(ToLongFunction<? super T> function) Get the sum of the elements in this collectable aslong
.<C extends Collection<T>>
CtoCollection
(Supplier<C> factory) Collect the collectable into aCollection
.toList()
Collect the collectable into anArrayList
.Collect the collectable into aList
.Collect the collectable into aMap
with the given keys and the self element as value.<K,
V> Map <K, V> Collect the collectable into aMap
.toSet()
Collect the collectable into aLinkedHashSet
.Collect the collectable into aSet
.toString()
toString
(CharSequence delimiter) Consume a stream and concatenate all elements using a separator.toString
(CharSequence delimiter, CharSequence prefix, CharSequence suffix) Shortcut for callingStream.collect(Collector)
with aCollectors.joining(CharSequence, CharSequence, CharSequence)
collector.Collect the collectable into an unmodifiableList
.Collect the collectable into an unmodifiableSet
.private int
upper()
private boolean
value()
The value of the current row in the window.window()
Stream all elements in the window.
-
Field Details
-
value
-
index
final int index -
partition
-
order
-
lower
final long lower -
upper
final long upper
-
-
Constructor Details
-
WindowImpl
-
-
Method Details
-
value
Description copied from interface:Window
The value of the current row in the window. -
window
Description copied from interface:Window
Stream all elements in the window. -
lower
private int lower() -
lowerInPartition
private boolean lowerInPartition() -
upper
private int upper() -
upperInPartition
private boolean upperInPartition() -
completePartition
private boolean completePartition() -
rowNumber
public long rowNumber()Description copied from interface:Window
The row number of the current row within the partition.// (1, 2, 3, 4, 5) Seq.of(1, 2, 4, 2, 3).window().map(w -> w.rowNumber());
-
rank
public long rank()Description copied from interface:Window
The rank of the current row within the partition.// (1, 2, 2, 4, 5) Seq.of(1, 2, 2, 3, 4).window(naturalOrder()).map(w -> w.rank());
-
denseRank
public long denseRank()Description copied from interface:Window
The dense rank of the current row within the partition.// (1, 2, 2, 3, 4) Seq.of(1, 2, 2, 3, 4).window(naturalOrder()).map(w -> w.denseRank());
-
percentRank
public double percentRank()Description copied from interface:Window
The precent rank of the current row within the partition.// (0.0, 0.25, 0.25, 0.75, 1.0) Seq.of(1, 2, 2, 3, 4).window(naturalOrder()).map(w -> w.percentRank());
- Specified by:
percentRank
in interfaceWindow<T>
-
ntile
public long ntile(long bucket) Description copied from interface:Window
The bucket number ("ntile") of the current row within the partition.// (0, 0, 1, 1, 2) Seq.of(1, 2, 2, 3, 4).window(naturalOrder()).map(w -> w.ntile(3));
-
lead
Description copied from interface:Window
The next value in the window.This is the same as calling
lead(1)
// (2, 2, 3, 4, empty) Seq.of(1, 2, 2, 3, 4).window().map(w -> w.lead());
-
lead
Description copied from interface:Window
The next value bylead
in the window.// (2, 2, 3, 4, empty) Seq.of(1, 2, 2, 3, 4).window().map(w -> w.lead());
-
lag
Description copied from interface:Window
The previous value in the window.This is the same as calling
lag(1)
// (empty, 1, 2, 2, 3) Seq.of(1, 2, 2, 3, 4).window().map(w -> w.lag());
-
lag
Description copied from interface:Window
The previous value bylag
in the window.// (empty, 1, 2, 2, 3) Seq.of(1, 2, 2, 3, 4).window().map(w -> w.lag());
-
lead0
-
firstValue
Description copied from interface:Window
The first value in the window.// (1, 1, 1, 1, 1) Seq.of(1, 2, 4, 2, 3).window().map(w -> w.firstValue());
- Specified by:
firstValue
in interfaceWindow<T>
-
firstValue
Description copied from interface:Window
The first value in the window.// (1, 1, 1, 1, 1) Seq.of(1, 2, 4, 2, 3).window().map(w -> w.firstValue());
- Specified by:
firstValue
in interfaceWindow<T>
-
lastValue
Description copied from interface:Window
The last value in the window.// (3, 3, 3, 3, 3) Seq.of(1, 2, 4, 2, 3).window().map(w -> w.lastValue());
-
lastValue
Description copied from interface:Window
The last value in the window.// (3, 3, 3, 3, 3) Seq.of(1, 2, 4, 2, 3).window().map(w -> w.lastValue());
-
nthValue
Description copied from interface:Window
The nth value in the window.// (4, 4, 4, 4, 4) Seq.of(1, 2, 4, 2, 3).window().map(w -> w.nthValue(2));
-
nthValue
Description copied from interface:Window
The nth value in the window.// (4, 4, 4, 4, 4) Seq.of(1, 2, 4, 2, 3).window().map(w -> w.nthValue(2));
-
count
public long count()Description copied from interface:Collectable
Count the values in this collectable.- Specified by:
count
in interfaceCollectable<T>
-
count
Description copied from interface:Collectable
Count the values in this collectable, for which a predicate evaluates to true.- Specified by:
count
in interfaceCollectable<T>
-
countDistinct
public long countDistinct()Description copied from interface:Collectable
Count the distinct values in this collectable.- Specified by:
countDistinct
in interfaceCollectable<T>
-
countDistinct
Description copied from interface:Collectable
Count the distinct values in this collectable, for which a predicate evaluates to true.- Specified by:
countDistinct
in interfaceCollectable<T>
-
countDistinctBy
Description copied from interface:Collectable
Count the distinct values of a given expression in this collectable.- Specified by:
countDistinctBy
in interfaceCollectable<T>
-
countDistinctBy
public <U> long countDistinctBy(Function<? super T, ? extends U> function, Predicate<? super U> predicate) Description copied from interface:Collectable
Count the distinct values of a given expression in this collectable, for which a predicate evaluates to true.- Specified by:
countDistinctBy
in interfaceCollectable<T>
-
sum
Description copied from interface:Collectable
Get the sum of the elements in this collectable.- Specified by:
sum
in interfaceCollectable<T>
-
sum
Description copied from interface:Collectable
Get the sum of the elements in this collectable.- Specified by:
sum
in interfaceCollectable<T>
-
sumInt
Description copied from interface:Collectable
Get the sum of the elements in this collectable asint
.- Specified by:
sumInt
in interfaceCollectable<T>
-
sumLong
Description copied from interface:Collectable
Get the sum of the elements in this collectable aslong
.- Specified by:
sumLong
in interfaceCollectable<T>
-
sumDouble
Description copied from interface:Collectable
Get the sum of the elements in this collectable asdouble
.- Specified by:
sumDouble
in interfaceCollectable<T>
-
avg
Description copied from interface:Collectable
Get the average of the elements in this collectable.- Specified by:
avg
in interfaceCollectable<T>
-
avg
Description copied from interface:Collectable
Get the average of the elements in this collectable.- Specified by:
avg
in interfaceCollectable<T>
-
avgInt
Description copied from interface:Collectable
Get the average of the elements in this collectable asint
.- Specified by:
avgInt
in interfaceCollectable<T>
-
avgLong
Description copied from interface:Collectable
Get the average of the elements in this collectable aslong
.- Specified by:
avgLong
in interfaceCollectable<T>
-
avgDouble
Description copied from interface:Collectable
Get the average of the elements in this collectable asdouble
.- Specified by:
avgDouble
in interfaceCollectable<T>
-
min
Description copied from interface:Collectable
Get the minimum value.This makes the unsafe assumption that
<T extends Comparable<? super T>>
- Specified by:
min
in interfaceCollectable<T>
-
min
Description copied from interface:Collectable
Get the minimum value by a function.- Specified by:
min
in interfaceCollectable<T>
-
min
Description copied from interface:Collectable
Get the minimum value by a function.- Specified by:
min
in interfaceCollectable<T>
-
min
public <U> Optional<U> min(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Description copied from interface:Collectable
Get the minimum value by a function.- Specified by:
min
in interfaceCollectable<T>
-
minBy
public <U extends Comparable<? super U>> Optional<T> minBy(Function<? super T, ? extends U> function) Description copied from interface:Collectable
Get the minimum value by a function.- Specified by:
minBy
in interfaceCollectable<T>
-
minBy
public <U> Optional<T> minBy(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Description copied from interface:Collectable
Get the minimum value by a function.- Specified by:
minBy
in interfaceCollectable<T>
-
minAll
Description copied from interface:Collectable
Get the minimum values.This makes the unsafe assumption that
<T extends Comparable<? super T>>
- Specified by:
minAll
in interfaceCollectable<T>
-
minAll
Description copied from interface:Collectable
Get the minimum values by a function.- Specified by:
minAll
in interfaceCollectable<T>
-
minAll
Description copied from interface:Collectable
Get the minimum values by a function.- Specified by:
minAll
in interfaceCollectable<T>
-
minAll
public <U> Seq<U> minAll(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Description copied from interface:Collectable
Get the minimum values by a function.- Specified by:
minAll
in interfaceCollectable<T>
-
minAllBy
Description copied from interface:Collectable
Get the minimum values by a function.- Specified by:
minAllBy
in interfaceCollectable<T>
-
minAllBy
public <U> Seq<T> minAllBy(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Description copied from interface:Collectable
Get the minimum values by a function.- Specified by:
minAllBy
in interfaceCollectable<T>
-
max
Description copied from interface:Collectable
Get the maximum value.This makes the unsafe assumption that
<T extends Comparable<? super T>>
- Specified by:
max
in interfaceCollectable<T>
-
max
Description copied from interface:Collectable
Get the maximum value by a function.- Specified by:
max
in interfaceCollectable<T>
-
max
Description copied from interface:Collectable
Get the maximum value by a function.- Specified by:
max
in interfaceCollectable<T>
-
max
public <U> Optional<U> max(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Description copied from interface:Collectable
Get the maximum value by a function.- Specified by:
max
in interfaceCollectable<T>
-
maxBy
public <U extends Comparable<? super U>> Optional<T> maxBy(Function<? super T, ? extends U> function) Description copied from interface:Collectable
Get the maximum value by a function.- Specified by:
maxBy
in interfaceCollectable<T>
-
maxBy
public <U> Optional<T> maxBy(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Description copied from interface:Collectable
Get the maximum value by a function.- Specified by:
maxBy
in interfaceCollectable<T>
-
maxAll
Description copied from interface:Collectable
Get the maximum values.This makes the unsafe assumption that
<T extends Comparable<? super T>>
- Specified by:
maxAll
in interfaceCollectable<T>
-
maxAll
Description copied from interface:Collectable
Get the maximum values by a function.- Specified by:
maxAll
in interfaceCollectable<T>
-
maxAll
Description copied from interface:Collectable
Get the maximum values by a function.- Specified by:
maxAll
in interfaceCollectable<T>
-
maxAll
public <U> Seq<U> maxAll(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Description copied from interface:Collectable
Get the maximum values by a function.- Specified by:
maxAll
in interfaceCollectable<T>
-
maxAllBy
Description copied from interface:Collectable
Get the maximum values by a function.- Specified by:
maxAllBy
in interfaceCollectable<T>
-
maxAllBy
public <U> Seq<T> maxAllBy(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Description copied from interface:Collectable
Get the maximum values by a function.- Specified by:
maxAllBy
in interfaceCollectable<T>
-
median
Description copied from interface:Collectable
Get the median value.This makes the unsafe assumption that
<T extends Comparable<? super T>>
- Specified by:
median
in interfaceCollectable<T>
-
median
Description copied from interface:Collectable
Get the median value.- Specified by:
median
in interfaceCollectable<T>
-
medianBy
public <U extends Comparable<? super U>> Optional<T> medianBy(Function<? super T, ? extends U> function) Description copied from interface:Collectable
Get the median value by a function.- Specified by:
medianBy
in interfaceCollectable<T>
-
medianBy
public <U> Optional<T> medianBy(Function<? super T, ? extends U> function, Comparator<? super U> comparator) Description copied from interface:Collectable
Get the median value by a function.- Specified by:
medianBy
in interfaceCollectable<T>
-
percentile
Description copied from interface:Collectable
Get the discrete percentile value.This makes the unsafe assumption that
<T extends Comparable<? super T>>
- Specified by:
percentile
in interfaceCollectable<T>
-
percentile
Description copied from interface:Collectable
Get the discrete percentile value.- Specified by:
percentile
in interfaceCollectable<T>
-
percentileBy
public <U extends Comparable<? super U>> Optional<T> percentileBy(double percentile, Function<? super T, ? extends U> function) Description copied from interface:Collectable
Get the discrete percentile value by a function.- Specified by:
percentileBy
in interfaceCollectable<T>
-
percentileBy
public <U> Optional<T> percentileBy(double percentile, Function<? super T, ? extends U> function, Comparator<? super U> comparator) Description copied from interface:Collectable
Get the discrete percentile value by a function.- Specified by:
percentileBy
in interfaceCollectable<T>
-
mode
Description copied from interface:Collectable
Get the mode, i.e. the value that appears most often in the collectable.- Specified by:
mode
in interfaceCollectable<T>
-
modeBy
Description copied from interface:Collectable
Get the mode, i.e. the value that appears most often in the collectable.- Specified by:
modeBy
in interfaceCollectable<T>
-
modeAll
Description copied from interface:Collectable
Get the mode, i.e. the values that appear most often in the collectable.- Specified by:
modeAll
in interfaceCollectable<T>
-
modeAllBy
Description copied from interface:Collectable
Get the mode, i.e. the values that appear most often in the collectable.- Specified by:
modeAllBy
in interfaceCollectable<T>
-
allMatch
Description copied from interface:Collectable
Whether all elements in the collectable match a given predicate.- Specified by:
allMatch
in interfaceCollectable<T>
-
anyMatch
Description copied from interface:Collectable
Whether any element in the collectable matches a given predicate.- Specified by:
anyMatch
in interfaceCollectable<T>
-
noneMatch
Description copied from interface:Collectable
Whether no element in the collectable matches a given predicate.- Specified by:
noneMatch
in interfaceCollectable<T>
-
bitAnd
Description copied from interface:Collectable
Collect all bits in this stream into a single value by applying bitwise and.- Specified by:
bitAnd
in interfaceCollectable<T>
-
bitAnd
Description copied from interface:Collectable
Collect all bits in this stream into a single value by applying bitwise and.- Specified by:
bitAnd
in interfaceCollectable<T>
-
bitAndInt
Description copied from interface:Collectable
Collect all bits in this stream into a single value by applying bitwise and.- Specified by:
bitAndInt
in interfaceCollectable<T>
-
bitAndLong
Description copied from interface:Collectable
Collect all bits in this stream into a single value by applying bitwise and.- Specified by:
bitAndLong
in interfaceCollectable<T>
-
bitOr
Description copied from interface:Collectable
Collect all bits in this stream into a single value by applying bitwise or.- Specified by:
bitOr
in interfaceCollectable<T>
-
bitOr
Description copied from interface:Collectable
Collect all bits in this stream into a single value by applying bitwise or.- Specified by:
bitOr
in interfaceCollectable<T>
-
bitOrInt
Description copied from interface:Collectable
Collect all bits in this stream into a single value by applying bitwise or.- Specified by:
bitOrInt
in interfaceCollectable<T>
-
bitOrLong
Description copied from interface:Collectable
Collect all bits in this stream into a single value by applying bitwise or.- Specified by:
bitOrLong
in interfaceCollectable<T>
-
collect
Description copied from interface:Collectable
Collect this collectable.- Specified by:
collect
in interfaceCollectable<T>
-
toList
Description copied from interface:Collectable
Collect the collectable into anArrayList
.- Specified by:
toList
in interfaceCollectable<T>
-
toList
Description copied from interface:Collectable
Collect the collectable into aList
.- Specified by:
toList
in interfaceCollectable<T>
-
toUnmodifiableList
Description copied from interface:Collectable
Collect the collectable into an unmodifiableList
.- Specified by:
toUnmodifiableList
in interfaceCollectable<T>
-
toSet
Description copied from interface:Collectable
Collect the collectable into aLinkedHashSet
.- Specified by:
toSet
in interfaceCollectable<T>
-
toSet
Description copied from interface:Collectable
Collect the collectable into aSet
.- Specified by:
toSet
in interfaceCollectable<T>
-
toUnmodifiableSet
Description copied from interface:Collectable
Collect the collectable into an unmodifiableSet
.- Specified by:
toUnmodifiableSet
in interfaceCollectable<T>
-
toCollection
Description copied from interface:Collectable
Collect the collectable into aCollection
.- Specified by:
toCollection
in interfaceCollectable<T>
-
toMap
public <K,V> Map<K,V> toMap(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper) Description copied from interface:Collectable
Collect the collectable into aMap
.- Specified by:
toMap
in interfaceCollectable<T>
-
toMap
Description copied from interface:Collectable
Collect the collectable into aMap
with the given keys and the self element as value.- Specified by:
toMap
in interfaceCollectable<T>
-
toString
-
toString
Description copied from interface:Collectable
Consume a stream and concatenate all elements using a separator.- Specified by:
toString
in interfaceCollectable<T>
-
toString
Description copied from interface:Collectable
Shortcut for callingStream.collect(Collector)
with aCollectors.joining(CharSequence, CharSequence, CharSequence)
collector.- Specified by:
toString
in interfaceCollectable<T>
-
commonPrefix
Description copied from interface:Collectable
Get the common prefix of all strings (or to-stringed values) in this stream.- Specified by:
commonPrefix
in interfaceCollectable<T>
-
commonSuffix
Description copied from interface:Collectable
Get the common prefix of all strings (or to-stringed values) in this stream.- Specified by:
commonSuffix
in interfaceCollectable<T>
-