< prev index next >

make/jdk/src/classes/build/tools/tzdb/TzdbZoneRulesCompiler.java

Print this page
rev 51769 : imported patch 8209880

*** 1,7 **** /* ! * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 63,83 **** import java.nio.file.Path; import java.nio.file.Paths; import java.text.ParsePosition; import java.util.ArrayList; import java.util.Arrays; - import java.util.HashMap; - import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.Scanner; import java.util.SortedMap; import java.util.TreeMap; import java.util.regex.Matcher; import java.util.regex.MatchResult; import java.util.regex.Pattern; /** * A compiler that reads a set of TZDB time-zone files and builds a single * combined TZDB data file. * --- 63,82 ---- import java.nio.file.Path; import java.nio.file.Paths; import java.text.ParsePosition; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.Scanner; import java.util.SortedMap; import java.util.TreeMap; import java.util.regex.Matcher; import java.util.regex.MatchResult; import java.util.regex.Pattern; + import java.util.stream.Collectors; /** * A compiler that reads a set of TZDB time-zone files and builds a single * combined TZDB data file. *
*** 254,265 **** String[] regionArray = builtZones.keySet().toArray(new String[builtZones.size()]); out.writeShort(regionArray.length); for (String regionId : regionArray) { out.writeUTF(regionId); } ! // rules -- hashset -> remove the dup ! List<ZoneRules> rulesList = new ArrayList<>(new HashSet<>(builtZones.values())); out.writeShort(rulesList.size()); ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); for (ZoneRules rules : rulesList) { baos.reset(); DataOutputStream dataos = new DataOutputStream(baos); --- 253,266 ---- String[] regionArray = builtZones.keySet().toArray(new String[builtZones.size()]); out.writeShort(regionArray.length); for (String regionId : regionArray) { out.writeUTF(regionId); } ! // rules -- remove the dup ! List<ZoneRules> rulesList = builtZones.values().stream() ! .distinct() ! .collect(Collectors.toList()); out.writeShort(rulesList.size()); ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); for (ZoneRules rules : rulesList) { baos.reset(); DataOutputStream dataos = new DataOutputStream(baos);
< prev index next >