Example usage for java.time ZoneId toString

List of usage examples for java.time ZoneId toString

Introduction

In this page you can find the example usage for java.time ZoneId toString.

Prototype

@Override
public String toString() 

Source Link

Document

Outputs this zone as a String , using the ID.

Usage

From source file:Main.java

public static void main(String[] args) {
    ZoneId z = ZoneId.systemDefault();
    System.out.println(z.toString());
}

From source file:de.rkl.tools.tzconv.model.ApplicationModel.java

private static SetMultimap<ZoneOffset, ZoneId> sortAvailableZoneIds() {
    final SortedSetMultimap<ZoneOffset, ZoneId> zoneIdMap = TreeMultimap.create(Ordering.natural().reverse(),
            new Ordering<ZoneId>() {
                @Override/*from   ww  w  . j  av a  2  s .  com*/
                public int compare(final ZoneId zoneId1, final ZoneId zoneId2) {
                    return ComparisonChain.start().compare(zoneId1.toString(), zoneId2.toString()).result();
                }
            }.nullsFirst());
    ZoneId.getAvailableZoneIds().stream().forEach(zoneId -> {
        final ZoneId zoneIdObject = ZoneId.of(zoneId);
        zoneIdMap.put(zoneIdObject.getRules().getStandardOffset(Instant.now()), zoneIdObject);
    });
    return ImmutableSetMultimap.copyOf(zoneIdMap);
}

From source file:com.inversoft.json.ZoneIdSerializer.java

@Override
public void serialize(ZoneId value, JsonGenerator jgen, SerializerProvider provider)
        throws IOException, JsonProcessingException {
    jgen.writeObject(value.toString());
}