public static Set < String > getAvailableIDs ( SystemTimeZoneType type , String region , Integer rawOffset ) { Set < String > baseSet = null ; switch ( type ) { case ANY : baseSet = getSystemZIDs ( ) ; break ; case CANONICAL : baseSet = getCanonicalSystemZIDs ( ) ; break ; case CANONICAL_LOCATION : baseSet = getCanonicalSystemLocationZIDs ( ) ; break ; default : // never occur throw new IllegalArgumentException ( "Unknown SystemTimeZoneType" ) ; } if ( region == null && rawOffset == null ) { return baseSet ; } if ( region != null ) { region = region . toUpperCase ( Locale . ENGLISH ) ; } // Filter by region/rawOffset Set < String > result = new TreeSet < String > ( ) ; for ( String id : baseSet ) { if ( region != null ) { String r = getRegion ( id ) ; if ( ! region . equals ( r ) ) { continue ; } } if ( rawOffset != null ) { // This is VERY inefficient. TimeZone z = getSystemTimeZone ( id ) ; if ( z == null || ! rawOffset . equals ( z . getRawOffset ( ) ) ) { continue ; } } result . add ( id ) ; } if ( result . isEmpty ( ) ) { return Collections . emptySet ( ) ; } return Collections . unmodifiableSet ( result ) ; }
Returns an immutable set of system IDs for the given conditions .