public final class Range extends Object
| Modifier and Type | Method and Description |
|---|---|
double[] |
asArray()
Get the range as an array of doubles.
|
List<Double> |
asList() |
double |
at(int i)
Return the ith element of this range, where indexing begins at 0.
|
double |
end()
Get the ending value of this range.
|
static Range |
exclusiveRange(double from,
double to)
Create a new range of doubles excluding the given to value, with a default spacing between
values of 1.0.
|
static Range |
exclusiveRange(double from,
double to,
double by)
Create a new range of doubles excluding the given to value.
|
static Range |
inclusiveRange(double from,
double to)
Create a new range of doubles including the given to value if possible, with a default spacing
between values of 1.0.
|
static Range |
inclusiveRange(double from,
double to,
double by)
Create a new range of doubles including the given to value if possible.
|
int |
size()
Get the size, or number of elements, of this range.
|
double |
start()
Get the starting value of this range.
|
double |
sum()
Get the sum of the data in this range.
|
String |
toString() |
public static Range exclusiveRange(double from, double to, double by)
from - the starting value of the range.to - the ending value of the range, not included in the result.by - the increment amount.public static Range inclusiveRange(double from, double to, double by)
from - the starting value of the range.to - the ending value of the range, included in the result if possible.by - the increment amount.public static Range exclusiveRange(double from, double to)
from - the starting value of the range.to - the ending value of the range, not included in the result.public static Range inclusiveRange(double from, double to)
from - the starting value of the range.to - the ending value of the range, included in the result if possible.public double[] asArray()
public double sum()
public int size()
public double start()
public double end()
public double at(int i)
i - the index of the range value to retrieve.