Package ch.obermuhlner.math.big.stream
Class BigDecimalStream
- java.lang.Object
-
- ch.obermuhlner.math.big.stream.BigDecimalStream
-
public class BigDecimalStream extends java.lang.Object
Provides constructor methods for streams ofBigDecimal
elements.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
BigDecimalStream.BigDecimalSpliterator
-
Constructor Summary
Constructors Constructor Description BigDecimalStream()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.stream.Stream<java.math.BigDecimal>
range(double startInclusive, double endExclusive, double step, java.math.MathContext mathContext)
Returns a sequential orderedStream<BigDecimal>
fromstartInclusive
(inclusive) toendExclusive
(exclusive) by an incrementalstep
.static java.util.stream.Stream<java.math.BigDecimal>
range(long startInclusive, long endExclusive, long step, java.math.MathContext mathContext)
Returns a sequential orderedStream<BigDecimal>
fromstartInclusive
(inclusive) toendExclusive
(exclusive) by an incrementalstep
.static java.util.stream.Stream<java.math.BigDecimal>
range(java.math.BigDecimal startInclusive, java.math.BigDecimal endExclusive, java.math.BigDecimal step, java.math.MathContext mathContext)
Returns a sequential orderedStream<BigDecimal>
fromstartInclusive
(inclusive) toendExclusive
(exclusive) by an incrementalstep
.static java.util.stream.Stream<java.math.BigDecimal>
rangeClosed(double startInclusive, double endInclusive, double step, java.math.MathContext mathContext)
Returns a sequential orderedStream<BigDecimal>
fromstartInclusive
(inclusive) toendInclusive
(inclusive) by an incrementalstep
.static java.util.stream.Stream<java.math.BigDecimal>
rangeClosed(long startInclusive, long endInclusive, long step, java.math.MathContext mathContext)
Returns a sequential orderedStream<BigDecimal>
fromstartInclusive
(inclusive) toendInclusive
(inclusive) by an incrementalstep
.static java.util.stream.Stream<java.math.BigDecimal>
rangeClosed(java.math.BigDecimal startInclusive, java.math.BigDecimal endInclusive, java.math.BigDecimal step, java.math.MathContext mathContext)
Returns a sequential orderedStream<BigDecimal>
fromstartInclusive
(inclusive) toendInclusive
(inclusive) by an incrementalstep
.
-
-
-
Method Detail
-
range
public static java.util.stream.Stream<java.math.BigDecimal> range(java.math.BigDecimal startInclusive, java.math.BigDecimal endExclusive, java.math.BigDecimal step, java.math.MathContext mathContext)
Returns a sequential orderedStream<BigDecimal>
fromstartInclusive
(inclusive) toendExclusive
(exclusive) by an incrementalstep
.An equivalent sequence of increasing values can be produced sequentially using a
for
loop as follows:for (BigDecimal i = startInclusive; i.compareTo(endExclusive) < 0; i = i.add(step, mathContext)) { // ... }
- Parameters:
startInclusive
- the (inclusive) initial valueendExclusive
- the exclusive upper boundstep
- the step between elementsmathContext
- theMathContext
used for all mathematical operations- Returns:
- a sequential
Stream<BigDecimal>
-
range
public static java.util.stream.Stream<java.math.BigDecimal> range(long startInclusive, long endExclusive, long step, java.math.MathContext mathContext)
Returns a sequential orderedStream<BigDecimal>
fromstartInclusive
(inclusive) toendExclusive
(exclusive) by an incrementalstep
.The
long
arguments are converted usingBigDecimal.valueOf(long)
.- Parameters:
startInclusive
- the (inclusive) initial valueendExclusive
- the exclusive upper boundstep
- the step between elementsmathContext
- theMathContext
used for all mathematical operations- Returns:
- a sequential
Stream<BigDecimal>
- See Also:
range(BigDecimal, BigDecimal, BigDecimal, MathContext)
-
range
public static java.util.stream.Stream<java.math.BigDecimal> range(double startInclusive, double endExclusive, double step, java.math.MathContext mathContext)
Returns a sequential orderedStream<BigDecimal>
fromstartInclusive
(inclusive) toendExclusive
(exclusive) by an incrementalstep
.The
double
arguments are converted usingBigDecimal.valueOf(double)
.- Parameters:
startInclusive
- the (inclusive) initial valueendExclusive
- the exclusive upper boundstep
- the step between elementsmathContext
- theMathContext
used for all mathematical operations- Returns:
- a sequential
Stream<BigDecimal>
- See Also:
range(BigDecimal, BigDecimal, BigDecimal, MathContext)
-
rangeClosed
public static java.util.stream.Stream<java.math.BigDecimal> rangeClosed(java.math.BigDecimal startInclusive, java.math.BigDecimal endInclusive, java.math.BigDecimal step, java.math.MathContext mathContext)
Returns a sequential orderedStream<BigDecimal>
fromstartInclusive
(inclusive) toendInclusive
(inclusive) by an incrementalstep
.An equivalent sequence of increasing values can be produced sequentially using a
for
loop as follows:for (BigDecimal i = startInclusive; i.compareTo(endInclusive) <= 0; i = i.add(step, mathContext)) { // ... }
- Parameters:
startInclusive
- the (inclusive) initial valueendInclusive
- the inclusive upper boundstep
- the step between elementsmathContext
- theMathContext
used for all mathematical operations- Returns:
- a sequential
Stream<BigDecimal>
- See Also:
range(BigDecimal, BigDecimal, BigDecimal, MathContext)
-
rangeClosed
public static java.util.stream.Stream<java.math.BigDecimal> rangeClosed(long startInclusive, long endInclusive, long step, java.math.MathContext mathContext)
Returns a sequential orderedStream<BigDecimal>
fromstartInclusive
(inclusive) toendInclusive
(inclusive) by an incrementalstep
.The
long
arguments are converted usingBigDecimal.valueOf(long)
.- Parameters:
startInclusive
- the (inclusive) initial valueendInclusive
- the inclusive upper boundstep
- the step between elementsmathContext
- theMathContext
used for all mathematical operations- Returns:
- a sequential
Stream<BigDecimal>
- See Also:
rangeClosed(BigDecimal, BigDecimal, BigDecimal, MathContext)
-
rangeClosed
public static java.util.stream.Stream<java.math.BigDecimal> rangeClosed(double startInclusive, double endInclusive, double step, java.math.MathContext mathContext)
Returns a sequential orderedStream<BigDecimal>
fromstartInclusive
(inclusive) toendInclusive
(inclusive) by an incrementalstep
.The
double
arguments are converted usingBigDecimal.valueOf(double)
.- Parameters:
startInclusive
- the (inclusive) initial valueendInclusive
- the inclusive upper boundstep
- the step between elementsmathContext
- theMathContext
used for all mathematical operations- Returns:
- a sequential
Stream<BigDecimal>
- See Also:
rangeClosed(BigDecimal, BigDecimal, BigDecimal, MathContext)
-
-