change time zone method name
This commit is contained in:
parent
67e78dbf76
commit
0b6a047cc0
|
@ -14,7 +14,7 @@ public class TimezoneDisplay {
|
|||
GMT, UTC
|
||||
}
|
||||
|
||||
public List<String> compileListFor(OffsetBase base) {
|
||||
public List<String> getTimeZoneList(OffsetBase base) {
|
||||
Set<String> availableZoneIds = ZoneId.getAvailableZoneIds();
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
|
|
@ -8,11 +8,11 @@ public class TimezoneDisplayApp {
|
|||
TimezoneDisplay display = new TimezoneDisplay();
|
||||
|
||||
System.out.println("Time zones in UTC:");
|
||||
List<String> utc = display.compileListFor(TimezoneDisplay.OffsetBase.UTC);
|
||||
List<String> utc = display.getTimeZoneList(TimezoneDisplay.OffsetBase.UTC);
|
||||
utc.forEach(System.out::println);
|
||||
|
||||
System.out.println("Time zones in GMT:");
|
||||
List<String> gmt = display.compileListFor(TimezoneDisplay.OffsetBase.GMT);
|
||||
List<String> gmt = display.getTimeZoneList(TimezoneDisplay.OffsetBase.GMT);
|
||||
gmt.forEach(System.out::println);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ public class TimezoneDisplayJava7 {
|
|||
GMT, UTC
|
||||
}
|
||||
|
||||
public List<String> compileListFor(TimezoneDisplayJava7.OffsetBase base) {
|
||||
public List<String> getTimeZoneList(TimezoneDisplayJava7.OffsetBase base) {
|
||||
String[] availableZoneIds = TimeZone.getAvailableIDs();
|
||||
List<String> result = new ArrayList<>(availableZoneIds.length);
|
||||
|
||||
|
|
|
@ -8,13 +8,13 @@ public class TimezoneDisplayJava7App {
|
|||
TimezoneDisplayJava7 display = new TimezoneDisplayJava7();
|
||||
|
||||
System.out.println("Time zones in UTC:");
|
||||
List<String> utc = display.compileListFor(TimezoneDisplayJava7.OffsetBase.UTC);
|
||||
List<String> utc = display.getTimeZoneList(TimezoneDisplayJava7.OffsetBase.UTC);
|
||||
for (String timeZone : utc) {
|
||||
System.out.println(timeZone);
|
||||
}
|
||||
|
||||
System.out.println("Time zones in GMT:");
|
||||
List<String> gmt = display.compileListFor(TimezoneDisplayJava7.OffsetBase.GMT);
|
||||
List<String> gmt = display.getTimeZoneList(TimezoneDisplayJava7.OffsetBase.GMT);
|
||||
for (String timeZone : gmt) {
|
||||
System.out.println(timeZone);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue