Package java.time

Examples of java.time.LocalDate


        assertThat(result).isEqualTo(LocalDate.of(1970, 1, 1));
    }

    @Test
    public void operationIsSymetric() {
        final LocalDate originalDate = LocalDate.of(2014, 1, 1);
        final Java8LocalDateConverter converter = new Java8LocalDateConverter();
        final Object serialized = converter.toDbValue(originalDate);
        final Object unserialized = converter.fromDbValue(serialized);

        assertThat(unserialized).isEqualTo(originalDate);
View Full Code Here


    @Override
    public void start(Stage stage) throws Exception {
        /*
         * Properties of any type can be easily injected.
         */
        LocalDate date = LocalDate.of(4242, Month.JULY, 21);
        Map<Object, Object> customProperties = new HashMap<>();
        customProperties.put("date", date);
        /*
         * any function which accepts an Object as key and returns
         * and return an Object as result can be used as source.
View Full Code Here

        /*
         * We need to convert to legacy Date using instant until JAX-RS can
         * handle Java 8 types...
         */
        LocalDate ldBirth = LocalDate.parse(isoDateOfBirth, DateTimeFormatter.ISO_LOCAL_DATE);
        Instant iBirth = ldBirth.atStartOfDay(ZoneId.systemDefault()).toInstant();

        Random r = new Random(123);

        EmployeeEntity newEmployee = new EmployeeEntity(r.nextLong(), name, Date.from(iBirth));

View Full Code Here

            passwordButton.setText("Remove password");
        }

        // Set the date picker to show the birthday of this wallet.
        Instant creationTime = Instant.ofEpochSecond(seed.getCreationTimeSeconds());
        LocalDate origDate = creationTime.atZone(ZoneId.systemDefault()).toLocalDate();
        datePicker.setValue(origDate);

        // Set the mnemonic seed words.
        final List<String> mnemonicCode = seed.getMnemonicCode();
        checkNotNull(mnemonicCode);    // Already checked for encryption.
        String origWords = Joiner.on(" ").join(mnemonicCode);
        wordsArea.setText(origWords);

        // Validate words as they are being typed.
        MnemonicCode codec = unchecked(MnemonicCode::new);
        TextFieldValidator validator = new TextFieldValidator(wordsArea, text ->
            !didThrow(() -> codec.check(Splitter.on(' ').splitToList(text)))
        );

        // Clear the date picker if the user starts editing the words, if it contained the current wallets date.
        // This forces them to set the birthday field when restoring.
        wordsArea.textProperty().addListener(o -> {
            if (origDate.equals(datePicker.getValue()))
                datePicker.setValue(null);
        });

        BooleanBinding datePickerIsInvalid = or(
                datePicker.valueProperty().isNull(),
View Full Code Here

  @Setup
  public void prepare() {
    ts = new TimeSeries();
    retainDates = new HashSet<>();
    removeDates = new HashSet<>();
    LocalDate now = LocalDate.now();
    for (int i = 0; i < 1500; i++) {
      LocalDate d = now.minusDays(i);
      if (i % 500 != 0) retainDates.add(d);
      else removeDates.add(d);
      ts.add(d, i);
    }
View Full Code Here

    return new ImmutableTimeSeries(dates, prices);
  }

  @Benchmark
  public double lastPrice_current() {
    LocalDate date = LocalDate.now().minusYears(1);
    return ts.lastPriceAt(date);
  }
View Full Code Here

    return ts.lastPriceAt(date);
  }

  @Benchmark
  public double lastPrice_immutable() {
    LocalDate date = LocalDate.now().minusYears(1);
    return its.lastPriceAt(date);
  }
View Full Code Here

TOP

Related Classes of java.time.LocalDate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.