/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; import java.time.* ; import java.util.stream.Collectors ; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { { Instant instant = Instant.now() ; ZoneOffset targetOffset = ZoneOffset.ofHours( 6 ) ; List< ZoneId > zonesUsingDesiredOffset = ZoneId .getAvailableZoneIds() // Returns a `Set` of `String` objects, the names of each known time zone. .stream() .map( zoneName -> ZoneId.of( zoneName ) ) // Map each zone name to `ZoneId` object. .filter( zoneId -> zoneId.getRules().getOffset( instant ).equals( targetOffset ) // Filter for zones whose offset at specified moment matches our desired offset. ) .collect( Collectors.toList() ) ; } }
Standard input is empty
[Asia/Kashgar, Etc/GMT-6, Asia/Almaty, Asia/Dacca, Asia/Omsk, Asia/Dhaka, Indian/Chagos, Asia/Qyzylorda, Asia/Bishkek, Antarctica/Vostok, Asia/Urumqi, Asia/Thimbu, Asia/Thimphu]