[threeten-dev] the "deduplicate" mechanism in tzdb compiler
Xueming Shen
xueming.shen at oracle.com
Sun Jan 20 11:53:35 PST 2013
The "deduplicate" mechanism in tzdb compiler looks really fishy, so I
took a look into how it really works. It turns out this is really something
not necessary, at least for the compiler tool we are looking for here.
All those date/time, offset, trans, transruls will be thrown out at the end,
why should we care about whether they are dup or not? they have been
created anyway. The only thing we really care here is the ZoneRules
which will be output to the tzdb.jar, they need to be de-duplicated
before written out. But this is being done perfectly at outputFile(s) via
the combination of
Set<ZoneRules> loopAllRules = new HashSet<ZoneRules>(builtZones.values());
...
List<ZoneRules> rulesList = new ArrayList<>(allRules);
...
int rulesIndex = rulesList.indexOf(entry.getValue());
The HashSet, ArrayList.indexOf() works on ZoneRules.equals() so
the ZoneRules objects are being effectively de-duplicated without
any help from that "deduplicate" mechanism.
http://cr.openjdk.java.net/~sherman/jdk8_threeten/zruleDup2
-Sherman
More information about the threeten-dev
mailing list