public final class LocalDateDoubleTimeSeriesBuilder extends Object
LocalDateDoubleTimeSeries.
This builder allows a time-series to be created. Entries can be added to the builder in any order. If a date is duplicated it will overwrite an earlier entry.
Use LocalDateDoubleTimeSeries.builder() to create an instance.
| Modifier and Type | Method and Description |
|---|---|
LocalDateDoubleTimeSeries |
build()
Build the time-series from the builder.
|
OptionalDouble |
get(LocalDate date)
Gets the value associated with the specified date.
|
LocalDateDoubleTimeSeriesBuilder |
merge(LocalDate date,
double value,
DoubleBinaryOperator operator)
Merges the specified date/value point into this builder.
|
LocalDateDoubleTimeSeriesBuilder |
merge(LocalDateDoublePoint point,
DoubleBinaryOperator operator)
Merges the specified date/value point into this builder.
|
LocalDateDoubleTimeSeriesBuilder |
put(LocalDate date,
double value)
Puts the specified date/value point into this builder.
|
LocalDateDoubleTimeSeriesBuilder |
put(LocalDateDoublePoint point)
Puts the specified date/value point into this builder.
|
LocalDateDoubleTimeSeriesBuilder |
putAll(Collection<LocalDate> dates,
Collection<Double> values)
Puts all the specified dates and values into this builder.
|
LocalDateDoubleTimeSeriesBuilder |
putAll(Collection<LocalDate> dates,
double[] values)
Puts all the specified dates and values into this builder.
|
LocalDateDoubleTimeSeriesBuilder |
putAll(List<LocalDateDoublePoint> points)
Puts all the specified points into this builder.
|
LocalDateDoubleTimeSeriesBuilder |
putAll(LocalDateDoubleTimeSeriesBuilder other)
Puts the contents of the specified builder into this builder.
|
LocalDateDoubleTimeSeriesBuilder |
putAll(Map<LocalDate,Double> map)
Puts all the entries from the supplied map into this builder.
|
LocalDateDoubleTimeSeriesBuilder |
putAll(Stream<LocalDateDoublePoint> points)
Puts all the specified points into this builder.
|
public OptionalDouble get(LocalDate date)
The result is an OptionalDouble which avoids the need to handle null
or exceptions. Use isPresent() to check whether the value is present.
Use orElse(double) to default a missing value.
date - the date to get the value forpublic LocalDateDoubleTimeSeriesBuilder put(LocalDate date, double value)
date - the date to be addedvalue - the value associated with the datepublic LocalDateDoubleTimeSeriesBuilder put(LocalDateDoublePoint point)
point - the point to be addedpublic LocalDateDoubleTimeSeriesBuilder merge(LocalDate date, double value, DoubleBinaryOperator operator)
The operator is invoked if the date already exists.
date - the date to be addedvalue - the value associated with the dateoperator - the operator to use for mergingpublic LocalDateDoubleTimeSeriesBuilder merge(LocalDateDoublePoint point, DoubleBinaryOperator operator)
The operator is invoked if the date already exists.
point - the point to be addedoperator - the operator to use for mergingpublic LocalDateDoubleTimeSeriesBuilder putAll(Collection<LocalDate> dates, Collection<Double> values)
The date and value collections must be the same size.
The date-value pairs are added one by one. If a date is duplicated it will overwrite an earlier entry.
dates - the dates to be addedvalues - the values to be addedpublic LocalDateDoubleTimeSeriesBuilder putAll(Collection<LocalDate> dates, double[] values)
The date collection and value array must be the same size.
The date-value pairs are added one by one. If a date is duplicated it will overwrite an earlier entry.
dates - the dates to be addedvalues - the values to be addedpublic LocalDateDoubleTimeSeriesBuilder putAll(Stream<LocalDateDoublePoint> points)
The points are added one by one. If a date is duplicated it will overwrite an earlier entry.
points - the points to be addedpublic LocalDateDoubleTimeSeriesBuilder putAll(List<LocalDateDoublePoint> points)
The points are added one by one. If a date is duplicated it will overwrite an earlier entry.
points - the points to be addedpublic LocalDateDoubleTimeSeriesBuilder putAll(LocalDateDoubleTimeSeriesBuilder other)
The points are added one by one. If a date is duplicated it will overwrite an earlier entry.
other - the other builderpublic LocalDateDoubleTimeSeriesBuilder putAll(Map<LocalDate,Double> map)
If a date is duplicated it will overwrite an earlier entry.
map - the map of points to be addedpublic LocalDateDoubleTimeSeries build()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.