Java Code Examples for java.util.OptionalDouble#orElseThrow()

The following examples show how to use java.util.OptionalDouble#orElseThrow() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ForwardOvernightCompoundedAnnualRateComputationFn.java    From Strata with Apache License 2.0 5 votes vote down vote up
private static double checkedFixing(
    LocalDate currentFixingTs,
    LocalDateDoubleTimeSeries indexFixingDateSeries,
    OvernightIndex index) {

  OptionalDouble fixedRate = indexFixingDateSeries.get(currentFixingTs);
  return fixedRate.orElseThrow(() -> new PricingException(
      "Could not get fixing value of index " + index.getName() + " for date " + currentFixingTs));
}
 
Example 2
Source File: ForwardOvernightCompoundedRateComputationFn.java    From Strata with Apache License 2.0 5 votes vote down vote up
private static double checkedFixing(
    LocalDate currentFixingTs,
    LocalDateDoubleTimeSeries indexFixingDateSeries,
    OvernightIndex index) {

  OptionalDouble fixedRate = indexFixingDateSeries.get(currentFixingTs);
  return fixedRate.orElseThrow(() -> new PricingException(
      "Could not get fixing value of index " + index.getName() + " for date " + currentFixingTs));
}
 
Example 3
Source File: ApproxForwardOvernightAveragedRateComputationFn.java    From Strata with Apache License 2.0 5 votes vote down vote up
private static double checkedFixing(
    LocalDate currentFixingTs,
    LocalDateDoubleTimeSeries indexFixingDateSeries,
    OvernightIndex index) {

  OptionalDouble fixedRate = indexFixingDateSeries.get(currentFixingTs);
  return fixedRate.orElseThrow(() -> new PricingException(
      "Could not get fixing value of index " + index.getName() + " for date " + currentFixingTs));
}
 
Example 4
Source File: BasicDouble.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=ObscureException.class)
public void testEmptyOrElseThrow() throws Exception {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(ObscureException::new);
}
 
Example 5
Source File: BasicDouble.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=NullPointerException.class)
public void testEmptyOrElseThrowNull() throws Throwable {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(null);
}
 
Example 6
Source File: BasicDouble.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=ObscureException.class)
public void testEmptyOrElseThrow() throws Exception {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(ObscureException::new);
}
 
Example 7
Source File: BasicDouble.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=ObscureException.class)
public void testEmptyOrElseThrow() throws Exception {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(ObscureException::new);
}
 
Example 8
Source File: BasicDouble.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=NullPointerException.class)
public void testEmptyOrElseThrowNull() throws Throwable {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(null);
}
 
Example 9
Source File: BasicDouble.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=ObscureException.class)
public void testEmptyOrElseThrow() throws Exception {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(ObscureException::new);
}
 
Example 10
Source File: BasicDouble.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=NullPointerException.class)
public void testEmptyOrElseThrowNull() throws Throwable {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(null);
}
 
Example 11
Source File: BasicDouble.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=ObscureException.class)
public void testEmptyOrElseThrow() throws Exception {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(ObscureException::new);
}
 
Example 12
Source File: BasicDouble.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=NullPointerException.class)
public void testEmptyOrElseThrowNull() throws Throwable {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(null);
}
 
Example 13
Source File: EchoServiceHandler.java    From drift with Apache License 2.0 4 votes vote down vote up
@Override
public double echoOptionalDouble(OptionalDouble value)
        throws EmptyOptionalException
{
    return value.orElseThrow(EmptyOptionalException::new);
}
 
Example 14
Source File: BasicDouble.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=ObscureException.class)
public void testEmptyOrElseThrow() throws Exception {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(ObscureException::new);
}
 
Example 15
Source File: BasicDouble.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=NullPointerException.class)
public void testEmptyOrElseThrowNull() throws Throwable {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(null);
}
 
Example 16
Source File: BasicDouble.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=ObscureException.class)
public void testEmptyOrElseThrow() throws Exception {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(ObscureException::new);
}
 
Example 17
Source File: BasicDouble.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=NullPointerException.class)
public void testEmptyOrElseThrowNull() throws Throwable {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(null);
}
 
Example 18
Source File: BasicDouble.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=ObscureException.class)
public void testEmptyOrElseThrow() throws Exception {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(ObscureException::new);
}
 
Example 19
Source File: BasicDouble.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=NullPointerException.class)
public void testEmptyOrElseThrowNull() throws Throwable {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(null);
}
 
Example 20
Source File: BasicDouble.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions=ObscureException.class)
public void testEmptyOrElseThrow() throws Exception {
    OptionalDouble empty = OptionalDouble.empty();

    double got = empty.orElseThrow(ObscureException::new);
}