Class BigDecimalStream

java.lang.Object
ch.obermuhlner.math.big.stream.BigDecimalStream

public class BigDecimalStream extends Object
Provides constructor methods for streams of BigDecimal elements.
  • Constructor Details

    • BigDecimalStream

      public BigDecimalStream()
  • Method Details

    • range

      public static Stream<BigDecimal> range(BigDecimal startInclusive, BigDecimal endExclusive, BigDecimal step, MathContext mathContext)
      Returns a sequential ordered Stream<BigDecimal> from startInclusive (inclusive) to endExclusive (exclusive) by an incremental step.

      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 value
      endExclusive - the exclusive upper bound
      step - the step between elements
      mathContext - the MathContext used for all mathematical operations
      Returns:
      a sequential Stream<BigDecimal>
    • range

      public static Stream<BigDecimal> range(long startInclusive, long endExclusive, long step, MathContext mathContext)
      Returns a sequential ordered Stream<BigDecimal> from startInclusive (inclusive) to endExclusive (exclusive) by an incremental step.

      The long arguments are converted using BigDecimal.valueOf(long).

      Parameters:
      startInclusive - the (inclusive) initial value
      endExclusive - the exclusive upper bound
      step - the step between elements
      mathContext - the MathContext used for all mathematical operations
      Returns:
      a sequential Stream<BigDecimal>
      See Also:
    • range

      public static Stream<BigDecimal> range(double startInclusive, double endExclusive, double step, MathContext mathContext)
      Returns a sequential ordered Stream<BigDecimal> from startInclusive (inclusive) to endExclusive (exclusive) by an incremental step.

      The double arguments are converted using BigDecimal.valueOf(double).

      Parameters:
      startInclusive - the (inclusive) initial value
      endExclusive - the exclusive upper bound
      step - the step between elements
      mathContext - the MathContext used for all mathematical operations
      Returns:
      a sequential Stream<BigDecimal>
      See Also:
    • rangeClosed

      public static Stream<BigDecimal> rangeClosed(BigDecimal startInclusive, BigDecimal endInclusive, BigDecimal step, MathContext mathContext)
      Returns a sequential ordered Stream<BigDecimal> from startInclusive (inclusive) to endInclusive (inclusive) by an incremental step.

      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 value
      endInclusive - the inclusive upper bound
      step - the step between elements
      mathContext - the MathContext used for all mathematical operations
      Returns:
      a sequential Stream<BigDecimal>
      See Also:
    • rangeClosed

      public static Stream<BigDecimal> rangeClosed(long startInclusive, long endInclusive, long step, MathContext mathContext)
      Returns a sequential ordered Stream<BigDecimal> from startInclusive (inclusive) to endInclusive (inclusive) by an incremental step.

      The long arguments are converted using BigDecimal.valueOf(long).

      Parameters:
      startInclusive - the (inclusive) initial value
      endInclusive - the inclusive upper bound
      step - the step between elements
      mathContext - the MathContext used for all mathematical operations
      Returns:
      a sequential Stream<BigDecimal>
      See Also:
    • rangeClosed

      public static Stream<BigDecimal> rangeClosed(double startInclusive, double endInclusive, double step, MathContext mathContext)
      Returns a sequential ordered Stream<BigDecimal> from startInclusive (inclusive) to endInclusive (inclusive) by an incremental step.

      The double arguments are converted using BigDecimal.valueOf(double).

      Parameters:
      startInclusive - the (inclusive) initial value
      endInclusive - the inclusive upper bound
      step - the step between elements
      mathContext - the MathContext used for all mathematical operations
      Returns:
      a sequential Stream<BigDecimal>
      See Also: