Skip to content

Commit

Permalink
Add Java 9 methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Spiridonov committed Jan 7, 2024
1 parent 707f319 commit ec70f64
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,23 +160,6 @@ public static Clock system(ZoneId zone) {

//-------------------------------------------------------------------------
/**
* Obtains a clock that returns the current instant ticking in whole milliseconds
* using best available system clock.
* <p>
* This clock will always have the nano-of-second field set to milliseconds part.
* This ensures that the visible time ticks in whole milliseconds.
* The underlying clock is the best available system clock, equivalent to
* using {@link #system(ZoneId)}.
* <p>
* Implementations may use a caching strategy for performance reasons.
* As such, it is possible that the start of the milliseconds observed via this
* clock will be later than that observed directly via the underlying clock.
* <p>
* The returned implementation is immutable, thread-safe and {@code Serializable}.
* It is equivalent to {@code tick(system(zone), Duration.ofMillis(1))}.
*
* @param zone the time-zone to use to convert the instant to date-time, not null
* @return a clock that ticks in whole milliseconds using the specified zone, not null
* @since 9
*/
public static Clock tickMillis(ZoneId zone) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -908,15 +908,6 @@ public Duration dividedBy(long divisor) {
}

/**
* Counts the number of times a given Duration occurs within this Duration.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param divisor the value to divide the duration by, positive or negative, not null
* @return the number of times a given Duration occurs within this Duration, may be zero
* or negative
* @throws ArithmeticException if the divisor is zero
* @throws ArithmeticException if numeric overflow occurs
* @since 9
*/
public long dividedBy(Duration divisor) {
Expand Down Expand Up @@ -1100,12 +1091,6 @@ public long toMinutes() {
}

/**
* Gets the number of seconds in this duration.
* <p>
* This returns the total number of seconds in the duration.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @since 9
*/
public long toSeconds() {
Expand Down Expand Up @@ -1241,16 +1226,6 @@ public int toNanosPart() {

//-----------------------------------------------------------------------
/**
* Returns a copy of this Duration truncated to the specified unit.
* <p>
* The fields of result under the given unit will be set to zero.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param unit the unit to truncate to, not null
* @return a truncated copy of Duration, not null
* @throws DateTimeException if the unit is invalid for truncation
* @throws UnsupportedTemporalTypeException if the unit is not supported
* @since 9
*/
public Duration truncatedTo(TemporalUnit unit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,6 @@ public static LocalDate ofYearDay(int year, int dayOfYear) {

//-----------------------------------------------------------------------
/**
* Obtains an instance of {@code LocalDate} from an Instant and zone ID.
* <p>
*
* @param instant the instant to create the date from, not null
* @param zone the time-zone, which may be an offset, not null
* @return the local date, not null
* @throws DateTimeException if the result exceeds the supported range
* @since 9
*/
public static LocalDate ofInstant(Instant instant, ZoneId zone) {
Expand Down Expand Up @@ -1519,13 +1512,6 @@ public Period until(ChronoLocalDate endDate) {
}

/**
* Returns stream of dates from now to given date (exclusive) with step of 1 day.
* <p>
* This method is equivalent to {@code datesUntil(endExclusive, Period.ofDays(1))}.
*
* @param endExclusive the end date, exclusive, not null
* @return a sequential {@code Stream} for the range of {@code LocalDate} values
* @throws IllegalArgumentException if end date is before this date
* @since 9
*/
public Stream<LocalDate> datesUntil(LocalDate endExclusive) {
Expand All @@ -1537,15 +1523,6 @@ public Stream<LocalDate> datesUntil(LocalDate endExclusive) {
return LongStream.range(start, end).mapToObj(LocalDate::ofEpochDay);
}
/**
* Returns stream of dates from now to given date (exclusive) with given step.
* <p>
*
* @param endExclusive the end date, exclusive, not null
* @param step the non-zero, non-negative {@code Period} which represents the step.
* @return a sequential {@code Stream} for the range of {@code LocalDate} values
* @throws IllegalArgumentException if step is zero, or {@code step.getDays()} and
* {@code step.toTotalMonths()} have opposite sign, or end date is before this date
* and step is positive, or end date is after this date and step is negative
* @since 9
*/
public Stream<LocalDate> datesUntil(LocalDate endExclusive, Period step) {
Expand Down Expand Up @@ -1759,12 +1736,6 @@ public long toEpochDay() {
}

/**
* Converts this {@code LocalDate} to the number of seconds since the
* 1970-01-01T00:00:00Z.
* <p>
* @param time the local time, not null
* @param offset the zone offset, not null
* @return the number of seconds since the 1970-01-01T00:00:00Z, may be negative
* @since 9
*/
public long toEpochSecond(LocalTime time, ZoneOffset offset) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,6 @@ public static LocalTime of(int hour, int minute, int second, int nanoOfSecond) {
}

/**
* Obtains an instance of {@code LocalTime} from an Instant and zone ID.
* <p>
* @param instant the instant to create the time from, not null
* @param zone the time-zone, which may be an offset, not null
* @return the local time, not null
* @since 9
*/
public static LocalTime ofInstant(Instant instant, ZoneId zone) {
Expand Down Expand Up @@ -1383,12 +1378,6 @@ public long toNanoOfDay() {
}

/**
* Returns the number of seconds since the 1970-01-01T00:00:00Z.
* <p>
*
* @param date the date used to calculate seconds, not null
* @param offset the zone offset used to calculate seconds, not null
* @return the number of seconds since the 1970-01-01, positive or negative
* @since 9
*/
public long toEpochSecond(LocalDate date, ZoneOffset offset) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1129,11 +1129,6 @@ private long toEpochNano() {
}

/**
* Returns the number of seconds since the 1970-01-01T00:00:00Z.
* <p>
*
* @param date the date used to calculate seconds, not null
* @return the number of seconds since the 1970-01-01, positive or negative
* @since 9
*/
public long toEpochSecond(LocalDate date) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,6 @@ void updateResolveMap(Map<TemporalField, Long> fieldValues, ChronoField field, l
//---------------------------------------------------------------------

/**
* GWT Specific
* @since 9
*/
public long epochSecond(int year, int month, int dayOfMonth, int hour, int minute, int second, ZoneOffset zoneOffset) {
Expand All @@ -788,7 +787,6 @@ public long epochSecond(int year, int month, int dayOfMonth, int hour, int minut
}

/**
* GWT Specific
* @since 9
*/
public long epochSecond(Era era, int yearOfEra, int month, int dayOfMonth, int hour, int minute, int second, ZoneOffset zoneOffset) {
Expand Down

0 comments on commit ec70f64

Please sign in to comment.