-
Notifications
You must be signed in to change notification settings - Fork 29
Description
Part 1:
Since we know all the unimplemented interface methods are public and abstract by default. Could we please update the below method definition in below interface web page:
Current interface definition:
public interface AbstractZoneTimeClient extends TimeClient { public ZonedDateTime getZonedDateTime(String zoneString); }
Updated interface definition:
public interface AbstractZoneTimeClient extends TimeClient { ZonedDateTime getZonedDateTime(String zoneString); }
Part 2:
As mentioned in oracle docs, all method declarations in an interface, including default methods, are implicitly public, so you can omit the public modifier. Could we remove the public from below interface definition default method:
Current interface definition:
public interface HandleInvalidTimeZoneClient extends TimeClient { default public ZonedDateTime getZonedDateTime(String zoneString) { try { return ZonedDateTime.of(getLocalDateTime(),ZoneId.of(zoneString)); } catch (DateTimeException e) { System.err.println("Invalid zone ID: " + zoneString + "; using the default time zone instead."); return ZonedDateTime.of(getLocalDateTime(),ZoneId.systemDefault()); } } }
Updated interface definition:
public interface HandleInvalidTimeZoneClient extends TimeClient { default ZonedDateTime getZonedDateTime(String zoneString) { try { return ZonedDateTime.of(getLocalDateTime(),ZoneId.of(zoneString)); } catch (DateTimeException e) { System.err.println("Invalid zone ID: " + zoneString + "; using the default time zone instead."); return ZonedDateTime.of(getLocalDateTime(),ZoneId.systemDefault()); } } }