From 054eb6e7a9537a036606ee78c96500b9312b04c9 Mon Sep 17 00:00:00 2001 From: btangmu Date: Wed, 15 Jan 2025 17:02:05 -0500 Subject: [PATCH] CLDR-18217 Refactor by removing Iterable interface from CLDRFile -Instead of Iterable interface, use new methods iterableDefault, iterableWithoutExtras -Private boolean CLDRFile.DEFAULT_ITERABLE_INCLUDES_EXTRAS determines whether iterableDefault calls fullIterable or iterableWithoutExtras -Call iterableWithoutExtras directly where tests would otherwise fail with DEFAULT_ITERABLE_INCLUDES_EXTRAS true -Rename original iterator method to iteratorWithoutExtras -Iterable and iterator are distinct: iterableWithoutExtras references iteratorWithoutExtras -There is not yet any iteratorDefault (only iterableDefault) --- .../org/unicode/cldr/web/CompareCLDRFile.java | 2 +- .../java/org/unicode/cldr/web/SurveyAjax.java | 2 +- .../org/unicode/cldr/web/SurveyMenus.java | 2 +- .../unicode/cldr/web/VettingViewerQueue.java | 2 +- .../unicode/cldr/web/api/VoteAPIHelper.java | 2 +- .../java/org/unicode/cldr/web/api/Whatis.java | 2 +- .../org/unicode/cldr/web/TestSTFactory.java | 2 +- .../unicode/cldr/api/CldrFileDataSource.java | 6 +-- .../unicode/cldr/draft/ExtractCountItems.java | 2 +- .../org/unicode/cldr/draft/JsonConverter.java | 3 +- .../unicode/cldr/json/Ldml2JsonConverter.java | 3 +- .../unicode/cldr/posix/POSIXUtilities.java | 3 +- .../test/BuildIcuCompactDecimalFormat.java | 2 +- .../java/org/unicode/cldr/test/CLDRTest.java | 14 ++--- .../cldr/test/CheckConsistentCasing.java | 2 +- .../org/unicode/cldr/test/CheckDates.java | 3 +- .../cldr/test/CheckDisplayCollisions.java | 3 +- .../unicode/cldr/test/ConsoleCheckCLDR.java | 2 +- .../org/unicode/cldr/test/CoverageLevel2.java | 3 +- .../java/org/unicode/cldr/test/DateOrder.java | 2 +- .../cldr/test/FlexibleDateFromCLDR.java | 2 +- .../unicode/cldr/test/FlexibleDateTime.java | 5 +- .../org/unicode/cldr/test/OutdatedPaths.java | 2 +- .../org/unicode/cldr/test/QuickCheck.java | 4 +- .../org/unicode/cldr/test/TestMetadata.java | 2 +- .../org/unicode/cldr/test/TestMetazones.java | 4 +- .../java/org/unicode/cldr/test/TestMisc.java | 13 +++-- .../org/unicode/cldr/tool/CLDRCompare.java | 4 +- .../cldr/tool/CLDRFilePseudolocalizer.java | 2 +- .../cldr/tool/CLDRFileTransformer.java | 2 +- .../org/unicode/cldr/tool/CLDRFormat.java | 4 +- .../org/unicode/cldr/tool/CLDRModify.java | 16 +++--- .../cldr/tool/ChartGrammaticalForms.java | 2 +- .../unicode/cldr/tool/ChartSupplemental.java | 2 +- .../cldr/tool/CheckEmojiAnnotations.java | 2 +- .../org/unicode/cldr/tool/CompareData.java | 6 +-- .../org/unicode/cldr/tool/CompareEmoji.java | 2 +- .../java/org/unicode/cldr/tool/CompareEn.java | 6 +-- .../org/unicode/cldr/tool/CompareLocales.java | 2 +- .../unicode/cldr/tool/CompareResolved.java | 4 +- .../cldr/tool/ConvertLanguageData.java | 3 +- .../cldr/tool/CopySubdivisionsIntoMain.java | 3 +- .../org/unicode/cldr/tool/CountItems.java | 4 +- .../java/org/unicode/cldr/tool/DiffCldr.java | 2 +- .../org/unicode/cldr/tool/DiffWithParent.java | 2 +- .../org/unicode/cldr/tool/FilterFactory.java | 10 ++-- .../org/unicode/cldr/tool/FindFlipFlops.java | 2 +- .../cldr/tool/FindHardInheritance.java | 2 +- .../unicode/cldr/tool/FindPreferredHours.java | 2 +- .../org/unicode/cldr/tool/FindWidths.java | 4 +- .../unicode/cldr/tool/GenerateAliases.java | 2 +- .../org/unicode/cldr/tool/GenerateBirth.java | 2 +- .../cldr/tool/GenerateCasingChart.java | 2 +- .../cldr/tool/GenerateChangeChart.java | 2 +- .../unicode/cldr/tool/GenerateComparison.java | 4 +- .../cldr/tool/GenerateCoverageLevels.java | 8 +-- .../unicode/cldr/tool/GenerateDayPeriods.java | 2 +- .../cldr/tool/GenerateDerivedAnnotations.java | 2 +- .../cldr/tool/GenerateEnglishChanged.java | 4 +- .../org/unicode/cldr/tool/GenerateEnums.java | 6 ++- .../tool/GenerateExampleDependencies.java | 2 +- .../org/unicode/cldr/tool/GenerateG2xG2.java | 2 +- .../tool/GenerateNumberingSystemAliases.java | 2 +- .../cldr/tool/GenerateProductionData.java | 5 +- .../cldr/tool/GenerateSidewaysView.java | 2 +- .../cldr/tool/GenerateTempDateData.java | 3 +- .../org/unicode/cldr/tool/GetChanges.java | 4 +- .../unicode/cldr/tool/ListCoverageLevels.java | 2 +- .../java/org/unicode/cldr/tool/ListUnits.java | 5 +- .../main/java/org/unicode/cldr/tool/Misc.java | 4 +- .../java/org/unicode/cldr/tool/PivotData.java | 5 +- .../unicode/cldr/tool/PluralMinimalPairs.java | 3 +- .../cldr/tool/PrepareRootAnnotations.java | 2 +- .../cldr/tool/RemoveEmptyCldrFiles.java | 2 +- .../org/unicode/cldr/tool/ShowChildren.java | 2 +- .../unicode/cldr/tool/ShowCoverageLevels.java | 2 +- .../java/org/unicode/cldr/tool/ShowData.java | 4 +- .../cldr/tool/ShowInconsistentAvailable.java | 6 +-- .../org/unicode/cldr/tool/ShowLanguages.java | 2 +- .../cldr/tool/ShowPathHeaderDescriptions.java | 2 +- .../cldr/tool/ShowRegionalVariants.java | 2 +- .../cldr/tool/ShowStarredCoverage.java | 2 +- .../org/unicode/cldr/tool/VettingAdder.java | 4 +- .../cldr/tool/resolver/ResolverUtils.java | 6 +-- .../java/org/unicode/cldr/util/CLDRFile.java | 54 ++++++++++++------- .../unicode/cldr/util/CharacterFallbacks.java | 3 +- .../unicode/cldr/util/DateTimeFormats.java | 8 +-- .../unicode/cldr/util/DayPeriodConverter.java | 2 +- .../org/unicode/cldr/util/DtdDataCheck.java | 2 +- .../cldr/util/ExtractCollationRules.java | 2 +- .../org/unicode/cldr/util/GrammarInfo.java | 3 +- .../org/unicode/cldr/util/TestUtilities.java | 2 +- .../unicode/cldr/util/TimezoneFormatter.java | 2 +- .../util/personname/PersonNameFormatter.java | 4 +- .../org/unicode/cldr/unittest/CheckYear.java | 4 +- .../cldr/unittest/NumberingSystemsTest.java | 2 +- .../org/unicode/cldr/unittest/TestAlt.java | 2 +- .../cldr/unittest/TestAnnotations.java | 13 +++-- .../org/unicode/cldr/unittest/TestBCP47.java | 8 +-- .../org/unicode/cldr/unittest/TestBasic.java | 14 ++--- .../unicode/cldr/unittest/TestCLDRFile.java | 8 +-- .../cldr/unittest/TestCheckAltOnly.java | 2 +- .../unicode/cldr/unittest/TestCheckCLDR.java | 8 +-- .../unittest/TestCheckDisplayCollisions.java | 2 +- .../cldr/unittest/TestCldrFactory.java | 8 +-- .../cldr/unittest/TestCldrResolver.java | 2 +- .../unicode/cldr/unittest/TestCollators.java | 2 +- .../cldr/unittest/TestCoverageLevel.java | 4 +- .../cldr/unittest/TestDTDAttributes.java | 2 +- .../unicode/cldr/unittest/TestDateOrder.java | 2 +- .../unicode/cldr/unittest/TestDayPeriods.java | 2 +- .../TestDisplayAndInputProcessor.java | 2 +- .../cldr/unittest/TestExampleGenerator.java | 2 +- .../cldr/unittest/TestInheritance.java | 2 +- .../org/unicode/cldr/unittest/TestLocale.java | 2 +- .../cldr/unittest/TestOutdatedPaths.java | 4 +- .../unicode/cldr/unittest/TestPathHeader.java | 11 ++-- .../unicode/cldr/unittest/TestPathLookup.java | 2 +- .../org/unicode/cldr/unittest/TestPaths.java | 6 +-- .../org/unicode/cldr/unittest/TestPerf.java | 2 +- .../unittest/TestPersonNameFormatter.java | 8 +-- .../unittest/TestStringByteConverter.java | 2 +- .../unicode/cldr/unittest/TestTransforms.java | 4 +- .../org/unicode/cldr/unittest/TestUnits.java | 15 +++--- .../unittest/UnicodeSetPrettyPrinterTest.java | 2 +- .../org/unicode/cldr/util/TestCLDRFile.java | 4 +- .../java/org/unicode/cldr/util/TestPUAs.java | 2 +- .../cldr/tool/WikiSubdivisionLanguages.java | 2 +- 128 files changed, 287 insertions(+), 243 deletions(-) diff --git a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/CompareCLDRFile.java b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/CompareCLDRFile.java index 2395b706ca0..dce4f4cc640 100644 --- a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/CompareCLDRFile.java +++ b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/CompareCLDRFile.java @@ -22,7 +22,7 @@ private Entry(CLDRFile f, String t) { this.file = f; this.title = t; - for (String s : f) { + for (String s : f.iterableDefault()) { xpaths.add(s); } diff --git a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyAjax.java b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyAjax.java index 770e5f52a14..f28c612d933 100644 --- a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyAjax.java +++ b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyAjax.java @@ -2604,7 +2604,7 @@ public static void handleBulkSubmit( CLDRFile baseFile = stf.make(loc.getBaseName(), false); Set all = new TreeSet<>(); - for (String x : cf) { + for (String x : cf.iterableDefault()) { if (x.startsWith("//ldml/identity")) { continue; } diff --git a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyMenus.java b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyMenus.java index 40af95aa281..a036d1cee97 100644 --- a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyMenus.java +++ b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyMenus.java @@ -34,7 +34,7 @@ public SurveyMenus(STFactory stFactory, PathHeader.Factory phf) { CLDRFile b = stFactory.sm.getEnglishFile(); phf = PathHeader.getFactory(b); - for (String xp : b) { + for (String xp : b.iterableDefault()) { phf.fromPath(xp); } for (String xp : b.getExtraPaths()) { diff --git a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/VettingViewerQueue.java b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/VettingViewerQueue.java index 239474482ed..bf313a4e63b 100644 --- a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/VettingViewerQueue.java +++ b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/VettingViewerQueue.java @@ -46,7 +46,7 @@ public static VettingViewerQueue getInstance() { */ private static int pathCount(CLDRFile f) { int jj = 0; - for (@SuppressWarnings("unused") String s : f) { + for (@SuppressWarnings("unused") String s : f.iterableDefault()) { jj++; } return jj; diff --git a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/api/VoteAPIHelper.java b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/api/VoteAPIHelper.java index 8d04824b8e6..b48b347ba15 100644 --- a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/api/VoteAPIHelper.java +++ b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/api/VoteAPIHelper.java @@ -103,7 +103,7 @@ static Response handleGetLocaleErrors(String loc) { resp.addAll(test.getPossibleProblems()); // add all non-path status - for (final String x : cldrFile) { + for (final String x : cldrFile.iterableDefault()) { List result = new ArrayList(); test.check(x, result, cldrFile.getStringValue(x)); for (final CheckStatus s : result) { diff --git a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/api/Whatis.java b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/api/Whatis.java index b7a537d867c..733b560cc75 100644 --- a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/api/Whatis.java +++ b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/api/Whatis.java @@ -94,7 +94,7 @@ private void searchPathsAndValues(WhatisResponse what) { continue; } XpathResult r = null; - for (String xp : f) { + for (String xp : f.iterableDefault()) { String str = f.getStringValue(xp); what.pathsSearched++; if (str.contains(q2)) { diff --git a/tools/cldr-apps/src/test/java/org/unicode/cldr/web/TestSTFactory.java b/tools/cldr-apps/src/test/java/org/unicode/cldr/web/TestSTFactory.java index 00c6c4a8d6f..06ac128f30c 100644 --- a/tools/cldr-apps/src/test/java/org/unicode/cldr/web/TestSTFactory.java +++ b/tools/cldr-apps/src/test/java/org/unicode/cldr/web/TestSTFactory.java @@ -73,7 +73,7 @@ public void TestBasicFactory() throws SQLException { STFactory fac = getFactory(); CLDRFile mt = fac.make(locale, false); BallotBox box = fac.ballotBoxForLocale(locale); - mt.iterator(); + mt.iteratorWithoutExtras(); final String somePath = "//ldml/localeDisplayNames/keys/key[@type=\"collation\"]"; box.getValues(somePath); } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/api/CldrFileDataSource.java b/tools/cldr-code/src/main/java/org/unicode/cldr/api/CldrFileDataSource.java index c17caa79f70..562990873bc 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/api/CldrFileDataSource.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/api/CldrFileDataSource.java @@ -29,7 +29,7 @@ public void accept(PathOrder order, ValueVisitor visitor) { Iterator paths; switch (order) { case ARBITRARY: - paths = source.iterator(); + paths = source.iteratorWithoutExtras(); break; case NESTED_GROUPING: @@ -42,11 +42,11 @@ public void accept(PathOrder order, ValueVisitor visitor) { // visited // consecutively. It also (like DTD ordering) greatly improves the performance when // parsing paths because consecutive paths share common parent elements. - paths = source.iterator(null, Comparator.naturalOrder()); + paths = source.iteratorWithoutExtras(null, Comparator.naturalOrder()); break; case DTD: - paths = source.iterator(null, source.getComparator()); + paths = source.iteratorWithoutExtras(null, source.getComparator()); break; default: diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/draft/ExtractCountItems.java b/tools/cldr-code/src/main/java/org/unicode/cldr/draft/ExtractCountItems.java index d0dbf4c5ec2..faae6458ae9 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/draft/ExtractCountItems.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/draft/ExtractCountItems.java @@ -153,7 +153,7 @@ private void showMinimalPairs( SampleData getSamples( CLDRFile cldr, int keywordCount, String prefix, Map data) { - for (String path : With.in(cldr.iterator(prefix, cldr.getComparator()))) { + for (String path : With.in(cldr.iteratorWithoutExtras(prefix, cldr.getComparator()))) { if (!path.contains("@count")) { continue; } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/draft/JsonConverter.java b/tools/cldr-code/src/main/java/org/unicode/cldr/draft/JsonConverter.java index 4dca81770c5..ad18ce7e836 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/draft/JsonConverter.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/draft/JsonConverter.java @@ -63,7 +63,8 @@ public static void main(String[] args) throws IOException { file.isNonInheriting() ? suppInfo : mainInfo; final Item main = new TableItem(null); DtdType dtdType = null; - for (Iterator it = file.iterator("", file.getComparator()); it.hasNext(); ) { + for (Iterator it = file.iteratorWithoutExtras("", file.getComparator()); + it.hasNext(); ) { final String xpath = it.next(); final String fullXpath = file.getFullXPath(xpath); String value = file.getStringValue(xpath); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/json/Ldml2JsonConverter.java b/tools/cldr-code/src/main/java/org/unicode/cldr/json/Ldml2JsonConverter.java index b9f0a65cb92..ba06f56a34b 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/json/Ldml2JsonConverter.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/json/Ldml2JsonConverter.java @@ -562,7 +562,8 @@ private Map> mapPathsToSections( // read paths in DTD order. The order is critical for JSON processing. final CLDRFile.Status status = new CLDRFile.Status(); for (Iterator it = - file.iterator("", DtdData.getInstance(fileDtdType).getDtdComparator(null)); + file.iteratorWithoutExtras( + "", DtdData.getInstance(fileDtdType).getDtdComparator(null)); it.hasNext(); ) { int cv = Level.UNDETERMINED.getLevel(); final String path = it.next(); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/posix/POSIXUtilities.java b/tools/cldr-code/src/main/java/org/unicode/cldr/posix/POSIXUtilities.java index 339a895300b..82283e4a74c 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/posix/POSIXUtilities.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/posix/POSIXUtilities.java @@ -168,7 +168,8 @@ else if (cp >= 0x0030 && cp <= 0x0039) // digits + "\"]/substitute"; for (Iterator it = - char_fallbk.iterator(SearchLocation, char_fallbk.getComparator()); + char_fallbk.iteratorWithoutExtras( + SearchLocation, char_fallbk.getComparator()); it.hasNext() && !SubFound; ) { String path = it.next(); substituteString = char_fallbk.getStringValue(path); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/BuildIcuCompactDecimalFormat.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/BuildIcuCompactDecimalFormat.java index a68ceb9bd86..6440d2ce90b 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/BuildIcuCompactDecimalFormat.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/BuildIcuCompactDecimalFormat.java @@ -141,7 +141,7 @@ public static Map> buildCustomData( ? "//ldml/numbers/decimalFormats[@numberSystem=\"latn\"]/decimalFormatLength" : "//ldml/numbers/currencyFormats[@numberSystem=\"latn\"]/currencyFormatLength"; - Iterator it = resolvedCldrFile.iterator(prefix); + Iterator it = resolvedCldrFile.iteratorWithoutExtras(prefix); String styleString = style.toString().toLowerCase(Locale.ENGLISH); while (it.hasNext()) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CLDRTest.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CLDRTest.java index 63d3e204a30..6f8cd930327 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CLDRTest.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CLDRTest.java @@ -138,7 +138,7 @@ public void TestCurrencyFormats() { boolean isPOSIX = locale.indexOf("POSIX") >= 0; logln("Testing: " + locale); CLDRFile item = cldrFactory.make(locale, false); - for (String xpath : item) { + for (String xpath : item.iterableDefault()) { NumericType type = NumericType.getNumericType(xpath); if (type == NumericType.NOT_NUMERIC) continue; String value = item.getStringValue(xpath); @@ -186,7 +186,7 @@ public void TestCommonChildren() { // Whenever two values for the same xpath are different, we remove from // currentValues, and add to // okValues - for (String xpath : item) { + for (String xpath : item.iterableDefault()) { if (okValues.contains(xpath)) continue; if (xpath.startsWith("//ldml/identity/")) continue; // skip identity elements String v = item.getStringValue(xpath); @@ -255,7 +255,7 @@ public void TestThatExemplarsContainAll() { int count = 0; localeMissing.clear(); file: - for (String xpath : plain) { + for (String xpath : plain.iterableDefault()) { for (int i = 0; i < EXEMPLAR_SKIPS.length; ++i) { if (xpath.indexOf(EXEMPLAR_SKIPS[i]) > 0) continue file; // skip some items. } @@ -512,7 +512,7 @@ public void TestDisplayNameCollisions() { } collisions.clear(); - for (Iterator it2 = item.iterator(); it2.hasNext(); ) { + for (Iterator it2 = item.iteratorWithoutExtras(); it2.hasNext(); ) { String xpath = it2.next(); NameType nameType = NameType.fromPath(xpath); if (nameType == NameType.NONE) continue; @@ -551,7 +551,7 @@ public void TestDisplayNameCollisions() { */ public static void checkAttributeValidity( CLDRFile item, Map> badCodes, Set xpathFailures) { - for (Iterator it2 = item.iterator(); it2.hasNext(); ) { + for (Iterator it2 = item.iteratorWithoutExtras(); it2.hasNext(); ) { String xpath = it2.next(); XPathParts parts = XPathParts.getFrozenInstance(item.getFullXPath(xpath)); for (int i = 0; i < parts.size(); ++i) { @@ -762,7 +762,7 @@ void getSupplementalData( boolean SHOW = false; Factory cldrFactory = Factory.make(CLDRPaths.MAIN_DIRECTORY, ".*"); CLDRFile supp = cldrFactory.make(CLDRFile.SUPPLEMENTAL_NAME, false); - for (Iterator it = supp.iterator(); it.hasNext(); ) { + for (Iterator it = supp.iteratorWithoutExtras(); it.hasNext(); ) { String path = it.next(); try { XPathParts parts = XPathParts.getFrozenInstance(supp.getFullXPath(path)); @@ -1360,7 +1360,7 @@ public void TestNarrowForms() { // Walk through all the xpaths, adding to currentValues // Whenever two values for the same xpath are different, we remove from currentValues, // and add to okValues - for (Iterator it2 = item.iterator(); it2.hasNext(); ) { + for (Iterator it2 = item.iteratorWithoutExtras(); it2.hasNext(); ) { String xpath = it2.next(); if (xpath.indexOf("[@type=\"narrow\"]") >= 0) { String value = item.getStringValue(xpath); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckConsistentCasing.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckConsistentCasing.java index f8a064cf6e3..d94f1d052e6 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckConsistentCasing.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckConsistentCasing.java @@ -305,7 +305,7 @@ public static Map getSamples(CLDRFile resolved) { boolean isRoot = "root".equals(resolved.getLocaleID()); Set missing = !DEBUG ? null : new TreeSet<>(); - for (String path : resolved) { + for (String path : resolved.iterableDefault()) { if (!isRoot) { String locale2 = resolved.getSourceLocaleID(path, null); if (locale2.equals("root") || locale2.equals("code-fallback")) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDates.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDates.java index c40b4e5993f..1a2a2be6dfa 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDates.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDates.java @@ -220,7 +220,8 @@ public CheckCLDR handleSetCldrFileToCheck( // load gregorian appendItems for (Iterator it = - resolved.iterator("//ldml/dates/calendars/calendar[@type=\"gregorian\"]"); + resolved.iteratorWithoutExtras( + "//ldml/dates/calendars/calendar[@type=\"gregorian\"]"); it.hasNext(); ) { String path = it.next(); String value = resolved.getWinningValue(path); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDisplayCollisions.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDisplayCollisions.java index b508ee5afa8..6d326305cee 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDisplayCollisions.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDisplayCollisions.java @@ -855,7 +855,8 @@ public String getRegionException(String regionCode) { // Pick up all instances in English where the exemplarCity and territory match // and include them as exceptions. exceptions = new HashMap<>(); - for (Iterator it = english.iterator(Type.ZONE.getPrefix()); it.hasNext(); ) { + for (Iterator it = english.iteratorWithoutExtras(Type.ZONE.getPrefix()); + it.hasNext(); ) { String xpath = it.next(); if (!xpath.endsWith("/exemplarCity")) continue; String value = english.getStringValue(xpath); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/ConsoleCheckCLDR.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/ConsoleCheckCLDR.java index 6894a6f8ba4..8397d875de6 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/ConsoleCheckCLDR.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/ConsoleCheckCLDR.java @@ -1686,7 +1686,7 @@ private static void addPrettyPaths( boolean noaliases, boolean filterDraft, Collection target) { - for (Iterator pit = file.iterator(pathFilter); pit.hasNext(); ) { + for (Iterator pit = file.iteratorWithoutExtras(pathFilter); pit.hasNext(); ) { String path = pit.next(); addPrettyPath(file, pathHeaderFactory, noaliases, filterDraft, target, path); } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CoverageLevel2.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CoverageLevel2.java index 6bc13088401..560224e9fb5 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CoverageLevel2.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CoverageLevel2.java @@ -392,7 +392,8 @@ private static void checkCoverage(String locale) { CLDRPaths.COMMON_DIRECTORY + "supplemental-temp/coverageLevels2.xml"); CLDRFile cldrFile = testInfo.getCldrFactory().make(locale, true); - Set paths = Builder.with(new TreeSet()).addAll(cldrFile).get(); + Set paths = + Builder.with(new TreeSet()).addAll(cldrFile.iterableDefault()).get(); PathHeader.Factory phf = PathHeader.getFactory(); Map diff = new TreeMap<>(); Map same = new TreeMap<>(); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/DateOrder.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/DateOrder.java index 1130e0b6206..c9932150a45 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/DateOrder.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/DateOrder.java @@ -68,7 +68,7 @@ public static Map> getOrderingInfo( Matcher typeMatcher = PatternCache.get("\\[@type=\"([^\"]*)\"]").matcher(""); int[] soFar = new int[50]; int lenSoFar = 0; - for (String path : resolved) { + for (String path : resolved.iterableDefault()) { if (DateTimePatternType.STOCK_AVAILABLE_INTERVAL_PATTERNS.contains( DateTimePatternType.fromPath(path))) { if (path.contains("[@id=\"Ed\"]")) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/FlexibleDateFromCLDR.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/FlexibleDateFromCLDR.java index f883b0294db..82816f3f93f 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/FlexibleDateFromCLDR.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/FlexibleDateFromCLDR.java @@ -255,7 +255,7 @@ private void addAvailableFormatsForFile( // ...dateTimeFormats/availableFormats/dateFormatItem[@id="..."][@count="..."][@draft="..."] // ...dateTimeFormats/availableFormats/dateFormatItem[@id="..."][@alt="variant"] boolean isRoot = file.getLocaleID().equals("root"); - for (Iterator it = file.iterator(toppath); it.hasNext(); ) { + for (Iterator it = file.iteratorWithoutExtras(toppath); it.hasNext(); ) { String path = it.next(); int startIndex = path.indexOf(DATE_FORMAT_ITEM_ID_PREFIX); if (startIndex < 0 || path.indexOf("[@alt=", startIndex) >= 0) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/FlexibleDateTime.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/FlexibleDateTime.java index 867709a2b49..664572150b1 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/FlexibleDateTime.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/FlexibleDateTime.java @@ -132,7 +132,8 @@ static class DeprecatedCodeFixer { { Factory cldrFactory = Factory.make(CLDRPaths.MAIN_DIRECTORY, ".*"); CLDRFile supp = cldrFactory.make(CLDRFile.SUPPLEMENTAL_NAME, false); - for (Iterator it = supp.iterator("//supplementalData/metadata/alias/"); + for (Iterator it = + supp.iteratorWithoutExtras("//supplementalData/metadata/alias/"); it.hasNext(); ) { String path = it.next(); XPathParts parts = XPathParts.getFrozenInstance(supp.getFullXPath(path)); @@ -374,7 +375,7 @@ static Collection getOOData(Factory cldrFactory, String locale) { System.out.println(); } CLDRFile item = cldrFactory.make(locale, false); - for (String xpath : item) { + for (String xpath : item.iterableDefault()) { if (!isGregorianPattern(xpath)) { continue; } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/OutdatedPaths.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/OutdatedPaths.java index 3c4a193d268..3e946b69b4e 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/OutdatedPaths.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/OutdatedPaths.java @@ -166,7 +166,7 @@ public Map getIdToPath(Factory factory) { Map result = new HashMap<>(); CLDRFile english = factory.make("en", true); PathHeader.Factory pathHeaders = PathHeader.getFactory(english); - for (String s : english) { + for (String s : english.iterableDefault()) { long id = StringId.getId(s); PathHeader pathHeader = pathHeaders.fromPath(s); result.put(id, pathHeader); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/QuickCheck.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/QuickCheck.java index ebdbdbe0852..c3f6fe746a7 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/QuickCheck.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/QuickCheck.java @@ -212,7 +212,7 @@ private static void checkPaths() { locale + "\t-\t" + english.nameGetter().getNameFromIdentifier(locale)); DtdType dtdType = null; - for (Iterator it = file.iterator(); it.hasNext(); ) { + for (Iterator it = file.iteratorWithoutExtras(); it.hasNext(); ) { String path = it.next(); if (path.endsWith("/alias")) { continue; @@ -341,7 +341,7 @@ private static void checkPaths() { } CLDRFile root = cldrFactory.make("root", true); - for (Iterator it = root.iterator(); it.hasNext(); ) { + for (Iterator it = root.iteratorWithoutExtras(); it.hasNext(); ) { pathToLocale.removeAll(it.next()); } if (showInfo) diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestMetadata.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestMetadata.java index 274dee707ec..aca0845c03e 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestMetadata.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestMetadata.java @@ -209,7 +209,7 @@ public static String showDifference( private static void testZones(CLDRFile metadata) { String zoneList = null; - for (Iterator it = metadata.iterator(); it.hasNext(); ) { + for (Iterator it = metadata.iteratorWithoutExtras(); it.hasNext(); ) { String key = it.next(); if (key.indexOf("\"$tzid\"") >= 0) { zoneList = metadata.getStringValue(key); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestMetazones.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestMetazones.java index a1cec08370a..f44df362f07 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestMetazones.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestMetazones.java @@ -141,7 +141,7 @@ private void fillMetazoneData( CLDRFile file, Relation mzoneToData, Relation zoneToDateRanges) { - for (String path : file) { + for (String path : file.iterableDefault()) { if (path.contains("/usesMetazone")) { /* * Sample: it = en.iterator(null, en.getComparator()); it.hasNext(); ) { + for (Iterator it = en.iteratorWithoutExtras(null, en.getComparator()); + it.hasNext(); ) { String path = it.next(); if (!m.reset(path).find()) { continue; @@ -564,7 +565,7 @@ private static void checkDistinguishing() { if (cldrFile.isNonInheriting()) { continue; } - for (Iterator it2 = cldrFile.iterator(); it2.hasNext(); ) { + for (Iterator it2 = cldrFile.iteratorWithoutExtras(); it2.hasNext(); ) { String path = it2.next(); if (dtdType == null) { dtdType = DtdType.fromPath(path); @@ -607,7 +608,7 @@ private static void showEnglish() { String requestedLocale = "en"; CLDRFile cldrFile = cldrFactory.make(requestedLocale, true); CLDRFile.Status status = new CLDRFile.Status(); - for (Iterator it = cldrFile.iterator(); it.hasNext(); ) { + for (Iterator it = cldrFile.iteratorWithoutExtras(); it.hasNext(); ) { String requestedPath = it.next(); String localeWhereFound = cldrFile.getSourceLocaleID(requestedPath, status); if (!localeWhereFound.equals(requestedLocale) @@ -638,7 +639,8 @@ private static void checkPrivateUse() { HashMap> foundItems = new HashMap<>(); TreeSet problems = new TreeSet<>(); for (Iterator it = - cldrFile.iterator("", new UTF16.StringComparator(true, false, 0)); + cldrFile.iteratorWithoutExtras( + "", new UTF16.StringComparator(true, false, 0)); it.hasNext(); ) { String requestedPath = it.next(); XPathParts parts = XPathParts.getFrozenInstance(requestedPath); @@ -714,7 +716,8 @@ static void testPopulous() { CLDRFile supp = cldrFactory.make("supplementalData", false); CLDRFile temp = SimpleFactory.makeFile("supplemental"); temp.setNonInheriting(true); - for (Iterator it = supp.iterator(null, supp.getComparator()); it.hasNext(); ) { + for (Iterator it = supp.iteratorWithoutExtras(null, supp.getComparator()); + it.hasNext(); ) { String path = it.next(); String value = supp.getStringValue(path); String fullPath = supp.getFullXPath(path); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRCompare.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRCompare.java index 2a804a95de8..a6b7e4e247f 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRCompare.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRCompare.java @@ -76,13 +76,13 @@ public static void main(String[] args) throws Exception { CLDRFile newCldrFile = null; try { newCldrFile = cldrFactory.make(file, false); - newCldrFile.forEach(paths::add); + newCldrFile.iterableDefault().forEach(paths::add); } catch (Exception e) { } CLDRFile oldCldrFile = null; try { oldCldrFile = oldFactory.make(file, false); - oldCldrFile.forEach(paths::add); + oldCldrFile.iterableDefault().forEach(paths::add); } catch (Exception e1) { } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRFilePseudolocalizer.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRFilePseudolocalizer.java index 0e6f8a31a1b..8b265f6d6a9 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRFilePseudolocalizer.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRFilePseudolocalizer.java @@ -403,7 +403,7 @@ public CLDRFile generate() { // Create input CLDRFile object resolving inherited data. CLDRFile input = factory.make(ORIGINAL_LOCALE, false); XMLSource outputSource = new SimpleXMLSource(outputLocale); - for (String xpath : input) { + for (String xpath : input.iterableWithoutExtras()) { String fullPath = input.getFullXPath(xpath); String value = input.getStringValue(xpath); if (!value.isEmpty()) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRFileTransformer.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRFileTransformer.java index 339b4249095..92ea40ea56c 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRFileTransformer.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRFileTransformer.java @@ -239,7 +239,7 @@ public CLDRFile transform(LocaleTransform localeTransform) { outputParent = factory.make(inputLocale, false); XMLSource outputSource = new SimpleXMLSource(localeTransform.toString()); DisplayAndInputProcessor daip = new DisplayAndInputProcessor(output, true); - for (String xpath : input) { + for (String xpath : input.iterableDefault()) { String value = input.getStringValue(xpath); if (CldrUtility.INHERITANCE_MARKER.equals(value)) { final String foundIn = input.getSourceLocaleID(xpath, null); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRFormat.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRFormat.java index 0cecd970bf9..288c6c81f31 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRFormat.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRFormat.java @@ -98,8 +98,8 @@ public static void main(String[] args) throws Exception { private static String findFirstDifference(CLDRFile cldrFile, CLDRFile regenFile) { keys1.clear(); keys2.clear(); - cldrFile.forEach(keys1::add); - regenFile.forEach(keys2::add); + cldrFile.iterableDefault().forEach(keys1::add); + regenFile.iterableDefault().forEach(keys2::add); if (!keys1.equals(keys2)) { Set missing = new TreeSet<>(keys1); missing.removeAll(keys2); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRModify.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRModify.java index ef45f9a4c4b..ae25cfd2d26 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRModify.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRModify.java @@ -516,11 +516,11 @@ public static void main(String[] args) throws Exception { "//ldml/dates/calendars/calendar[@type=\"persian\"]/months/monthContext[@type=\"format\"]/monthWidth[@type=\"abbreviated\"]/alias"; System.out.println(k.getStringValue(testPath)); TreeSet s = new TreeSet(); - k.forEach(s::add); + k.iterableDefault().forEach(s::add); System.out.println(k.getStringValue(testPath)); Set orderedSet = new TreeSet(k.getComparator()); - k.forEach(orderedSet::add); + k.iterableDefault().forEach(orderedSet::add); for (Iterator it3 = orderedSet.iterator(); it3.hasNext(); ) { String path = (String) it3.next(); if (path.equals(testPath)) { @@ -665,7 +665,7 @@ private static void checkSuboptions(int i, UnicodeSet allowedOptions) { private static void removePosix(CLDRFile toMergeIn) { Set toRemove = new HashSet<>(); - for (String xpath : toMergeIn) { + for (String xpath : toMergeIn.iterableDefault()) { if (xpath.startsWith("//ldml/posix")) toRemove.add(xpath); } toMergeIn.removeAll(toRemove, false); @@ -2532,7 +2532,7 @@ public void handleStart() { resolved = factory.make(cldrFileToFilter.getLocaleID(), true); } - for (String xpath : vxmlCommonMainFile) { + for (String xpath : vxmlCommonMainFile.iterableDefault()) { String vxmlValue = vxmlCommonMainFile.getStringValue(xpath); if (vxmlValue == null) { continue; @@ -3003,7 +3003,7 @@ public void handleEnd() { String localeL1 = parentChain.get(parentChain.size() - 2); // get last before root CLDRFile fileL1 = factory.make(localeL1, false); // only unresolved paths - for (String path : fileL1) { + for (String path : fileL1.iterableDefault()) { if (!pathsHandled.contains(path)) { handlePath(path); } @@ -3195,13 +3195,13 @@ static void fixIdenticalChildren(Factory cldrFactory, CLDRFile k, CLDRFile repla Map haveSameValues = new TreeMap<>(); CLDRFile resolvedFile = cldrFactory.make(key, true); // get only those paths that are not in "root" - resolvedFile.forEach(skipPaths::add); + resolvedFile.iterableDefault().forEach(skipPaths::add); // first, collect all the paths for (String locale : availableChildren) { if (locale.indexOf("POSIX") >= 0) continue; CLDRFile item = cldrFactory.make(locale, false); - for (String xpath : item) { + for (String xpath : item.iterableDefault()) { if (skipPaths.contains(xpath)) continue; // skip certain elements if (xpath.indexOf("/identity") >= 0) continue; @@ -3248,7 +3248,7 @@ private static void fix(CLDRFile k, String inputOptions, String config, Factory CLDRFile replacements = SimpleFactory.makeFile("temp"); fixList.setFile(k, inputOptions, cldrFactory, removal, replacements); - for (String xpath : k) { + for (String xpath : k.iterableDefault()) { fixList.handlePath(xpath); } fixList.handleEnd(); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartGrammaticalForms.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartGrammaticalForms.java index a6c6b35a37a..3ef87a51c99 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartGrammaticalForms.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartGrammaticalForms.java @@ -463,7 +463,7 @@ public void writeSubcharts(Anchors anchors) throws IOException { Set unitsToAddGrammar = new TreeSet<>(rawUnitsToAddGrammar); Map minimalInfo = new TreeMap<>(); PathHeader.Factory phf = PathHeader.getFactory(); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (!path.startsWith("//ldml/units/unitLength[@type=\"long\"]/unit")) { if (path.startsWith("//ldml/numbers/minimalPairs/")) { if (!path.contains("ordinal")) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSupplemental.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSupplemental.java index 6fdfc9e92bf..44151b45eb2 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSupplemental.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSupplemental.java @@ -60,7 +60,7 @@ public void writeContents( pp.addAll(test.getPossibleProblems()); // add all non-path status - for (final String x : cldrFile) { + for (final String x : cldrFile.iterableDefault()) { List result = new ArrayList(); test.check(x, result, cldrFile.getStringValue(x)); for (final CheckStatus s : result) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CheckEmojiAnnotations.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CheckEmojiAnnotations.java index a49c0df9c67..a60b67b0371 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CheckEmojiAnnotations.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CheckEmojiAnnotations.java @@ -28,7 +28,7 @@ public static void main(String[] args) { UnicodeSet rgiNoVariant = Emoji.getAllRgiNoES(); CLDRFile root = CLDRConfig.getInstance().getAnnotationsFactory().make("en", false); UnicodeSet rootEmoji = new UnicodeSet(); - for (String path : root) { + for (String path : root.iterableDefault()) { XPathParts parts = XPathParts.getFrozenInstance(path); String cp = parts.getAttributeValue(-1, "cp"); if (cp != null && rgiNoVariant.contains(cp) == chooseEmoji) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareData.java index 66b49999b77..7895a0b46b8 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareData.java @@ -63,7 +63,7 @@ public static void main(String[] args) throws Exception { try { CLDRFile oldFile = oldFactory.make(locale, false); pathsSeen.clear(); - for (Iterator it2 = file.iterator(); it2.hasNext(); ) { + for (Iterator it2 = file.iteratorWithoutExtras(); it2.hasNext(); ) { String path = it2.next(); String value = file.getStringValue(path); String oldValue = oldFile.getStringValue(path); @@ -76,14 +76,14 @@ public static void main(String[] args) throws Exception { } pathsSeen.add(path); } - for (Iterator it2 = oldFile.iterator(); it2.hasNext(); ) { + for (Iterator it2 = oldFile.iteratorWithoutExtras(); it2.hasNext(); ) { String path = it2.next(); if (!pathsSeen.contains(path)) { deletedItems++; } } } catch (Exception e) { - newItems = size(file.iterator()); + newItems = size(file.iteratorWithoutExtras()); } String langScript = new LocaleIDParser().set(file.getLocaleID()).getLanguageScript(); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareEmoji.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareEmoji.java index 3e5693f9398..d37d517443b 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareEmoji.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareEmoji.java @@ -119,7 +119,7 @@ private static Map getDataFor(String locale) { } public static void getDataIn(CLDRFile cldrfile, Map result, Status status) { - for (String path : cldrfile) { + for (String path : cldrfile.iterableDefault()) { XPathParts parts = XPathParts.getFrozenInstance(path); String cp = parts.getAttributeValue(-1, "cp"); if (cp == null) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareEn.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareEn.java index 5785a4d1708..9deeb25f25a 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareEn.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareEn.java @@ -80,7 +80,7 @@ private static void uplevelEnGB() throws IOException { // walk through all the new paths and values to check them. TreeSet paths = new TreeSet<>(); - en_GB.forEach(paths::add); + en_GB.iterableDefault().forEach(paths::add); for (String path : paths) { // skip certain paths @@ -183,8 +183,8 @@ private static void writeComparison() throws IOException { // walk through all the new paths and values to check them. TreeSet paths = new TreeSet<>(); - en_GB.forEach(x -> paths.add(phf.fromPath(x))); - en_001.forEach(x -> paths.add(phf.fromPath(x))); + en_GB.iterableDefault().forEach(x -> paths.add(phf.fromPath(x))); + en_001.iterableDefault().forEach(x -> paths.add(phf.fromPath(x))); main: for (PathHeader pathHeader : paths) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareLocales.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareLocales.java index 347c8329e72..0628c17ee88 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareLocales.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareLocales.java @@ -102,7 +102,7 @@ public static void main(String[] args) { prefix = "\t"; CLDRFile cldrFile = factory.make(locale, true); files.add(cldrFile); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { paths.add(path); } } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareResolved.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareResolved.java index c5f4268b2fc..37681c46bff 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareResolved.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareResolved.java @@ -124,8 +124,8 @@ public static void main(String[] args) { // get the union of paths Set sortedPaths = new TreeSet<>(); // could sort by PathHeader also - sortedPaths.addAll(Sets.newTreeSet(sourceFile)); - sortedPaths.addAll(Sets.newTreeSet(compareFile)); + sortedPaths.addAll(Sets.newTreeSet(sourceFile.iterableDefault())); + sortedPaths.addAll(Sets.newTreeSet(compareFile.iterableDefault())); // cycle over the union of paths int filterCount = 0; diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ConvertLanguageData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ConvertLanguageData.java index dfdc42a6b96..51fb57b8cba 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ConvertLanguageData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ConvertLanguageData.java @@ -659,7 +659,8 @@ private LanguageInfo() { // Set available = cldrFactory.getAvailable(); CLDRFile supplemental = cldrFactory.make("supplementalData", true); for (Iterator it = - supplemental.iterator("//supplementalData/languageData/language"); + supplemental.iteratorWithoutExtras( + "//supplementalData/languageData/language"); it.hasNext(); ) { String xpath = it.next(); XPathParts parts = XPathParts.getFrozenInstance(xpath); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CopySubdivisionsIntoMain.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CopySubdivisionsIntoMain.java index 0f63f6c4825..83a948d72af 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CopySubdivisionsIntoMain.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CopySubdivisionsIntoMain.java @@ -102,7 +102,8 @@ private static void doAfter() { CLDRFile subdivisionFileOut = null; for (Iterator subdivisionIterator = - mainFile.iterator(SubdivisionNames.SUBDIVISION_PATH_PREFIX); + mainFile.iteratorWithoutExtras( + SubdivisionNames.SUBDIVISION_PATH_PREFIX); subdivisionIterator.hasNext(); ) { String path = subdivisionIterator.next(); String value = mainFile.getStringValue(path); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CountItems.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CountItems.java index 1b416490f17..a2c33ce0f53 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CountItems.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CountItems.java @@ -1144,7 +1144,7 @@ private static int countItems(Factory cldrFactory, boolean resolved) { CLDRFile item = cldrFactory.make(locale, false); temp.clear(); - for (Iterator it2 = item.iterator(); it2.hasNext(); ) { + for (Iterator it2 = item.iteratorWithoutExtras(); it2.hasNext(); ) { String path = it2.next(); if (alt.reset(path).matches()) { continue; @@ -1158,7 +1158,7 @@ private static int countItems(Factory cldrFactory, boolean resolved) { CLDRFile itemResolved = cldrFactory.make(locale, true); temp.clear(); - itemResolved.forEach(temp::add); + itemResolved.iterableDefault().forEach(temp::add); int resolvedCurrent = temp.size(); System.out.println( diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DiffCldr.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DiffCldr.java index ad112c5c397..25a1147a742 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DiffCldr.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DiffCldr.java @@ -103,7 +103,7 @@ public static void main(String[] args) { CLDRFile cldrFile = factory.make(locale, isBase); DtdData dtdData = cldrFile.getDtdData(); CLDRFile cldrFileResolved = factory.make(locale, true); - for (String distinguishedPath : With.in(cldrFile.iterator())) { + for (String distinguishedPath : With.in(cldrFile.iteratorWithoutExtras())) { String path = cldrFile.getFullXPath(distinguishedPath); XPathParts pathPlain = XPathParts.getFrozenInstance(path); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DiffWithParent.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DiffWithParent.java index 4fcd0227a2d..15b329019f9 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DiffWithParent.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DiffWithParent.java @@ -42,7 +42,7 @@ public static void main(String[] args) throws IOException { CLDRFile parent = cldrFactory.make(parentLocale, true); // use // resolved // parent - for (Iterator it = file.iterator(); it.hasNext(); ) { + for (Iterator it = file.iteratorWithoutExtras(); it.hasNext(); ) { String path = it.next(); String value = file.getStringValue(path); String fullPath = file.getFullXPath(path); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FilterFactory.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FilterFactory.java index 2eb6e68d539..53c0582cea7 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FilterFactory.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FilterFactory.java @@ -131,7 +131,7 @@ private void filterCoverage(CLDRFile rawFile) { .getLocaleCoverageLevel(organization, rawFile.getLocaleID()) .getLevel(); CoverageInfo covInfo = CLDRConfig.getInstance().getCoverageInfo(); - for (String xpath : rawFile) { + for (String xpath : rawFile.iterableDefault()) { // Locale metadata shouldn't be stripped. int level = covInfo.getCoverageValue(xpath, rawFile.getLocaleID()); if (level > minLevel) { @@ -151,7 +151,7 @@ private void removeRedundantPaths(CLDRFile rawFile) { String parent = LocaleIDParser.getParent(rawFile.getLocaleID()); CLDRFile resolvedParent = rawFactory.make(parent, true); List duplicatePaths = new ArrayList<>(); - for (String xpath : rawFile) { + for (String xpath : rawFile.iterableDefault()) { if (xpath.startsWith("//ldml/identity")) { continue; } @@ -288,10 +288,10 @@ public void modifyFile(CLDRFile file) { file.add(filteringPath, value); } } else { - Iterator iterator = file.iterator(); + Iterator iterator = file.iteratorWithoutExtras(); if (filteringPath != null) { Matcher matcher = PatternCache.get(filteringPath).matcher(""); - iterator = file.iterator(matcher); + iterator = file.iteratorWithoutExtras(matcher); } while (iterator.hasNext()) { String xpath = iterator.next(); @@ -327,7 +327,7 @@ public void addModifierEntry(ModifierEntry entry) { public void modifyFile(CLDRFile file) { if (xpathLookup.size() > 0) { Output arguments = new Output<>(); - for (String xpath : file) { + for (String xpath : file.iterableDefault()) { String newValue = xpathLookup.get(xpath, null, arguments, null, null); if (newValue != null) { String newPath = RegexLookup.replace(newValue, arguments.value); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindFlipFlops.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindFlipFlops.java index 69ddb320e72..e9c26d8b563 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindFlipFlops.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindFlipFlops.java @@ -113,7 +113,7 @@ private static void findFlops(String fileName) { CLDRFile[] files = new CLDRFile[factories.length]; DisplayAndInputProcessor[] processors = new DisplayAndInputProcessor[factories.length]; setUpFilesAndProcessors(fileName, files, processors); - for (String xpath : files[0]) { + for (String xpath : files[0].iterableDefault()) { xpath = xpath.intern(); final String base = getProcessedStringValue(xpath, files[0], processors[0]); final ArrayList history = new ArrayList<>(); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindHardInheritance.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindHardInheritance.java index 9f62a365724..bfa433dd847 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindHardInheritance.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindHardInheritance.java @@ -127,7 +127,7 @@ private static Info getCounts( CLDRFile cldrFile = factory.make(localeId, true, DraftStatus.contributed); CLDRFile unresolvedCldrFile = factory.make(localeId, false, DraftStatus.contributed); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (path.startsWith("//ldml/identity/")) { continue; } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindPreferredHours.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindPreferredHours.java index ec08159048c..87f772922e7 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindPreferredHours.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindPreferredHours.java @@ -124,7 +124,7 @@ public static void main(String[] args) { // continue; // } final CLDRFile cldrFile = factory.make(locale, true); - for (String path : With.in(cldrFile)) { + for (String path : With.in(cldrFile.iterableDefault())) { // if (path.contains("/timeFormats")) { // System.out.println(path); // } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindWidths.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindWidths.java index e7badd8a7a0..7b5bccf34c8 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindWidths.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindWidths.java @@ -48,7 +48,7 @@ public static void main(String[] args) { Map maxWidths = new TreeMap<>(); Set sampleLocales = StandardCodes.make().getLocaleCoverageLocales("google"); - for (String path : english) { + for (String path : english.iterableDefault()) { PathHeader ph = phf.fromPath(path); PageId pageId = ph.getPageId(); SectionId sectionId = ph.getSectionId(); @@ -66,7 +66,7 @@ public static void main(String[] args) { } System.out.println(locale); CLDRFile file = CLDR_FACTORY.make(locale, false); - for (String path : file) { + for (String path : file.iterableDefault()) { PathHeader ph = phf.fromPath(path); Integer englishWidth = englishWidths.get(ph); if (englishWidth == null) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateAliases.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateAliases.java index f4b69adc712..b964192ef6b 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateAliases.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateAliases.java @@ -260,7 +260,7 @@ private boolean isWholeAlias(Factory factory, String localeID) { wholeAliasCache.put(localeID, false); return false; } - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (path.startsWith("//ldml/identity")) { continue; } else if (path.startsWith("//ldml/alias")) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateBirth.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateBirth.java index 79caf934818..874ac6cb5e7 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateBirth.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateBirth.java @@ -300,7 +300,7 @@ static class Births { System.out.println(String.format("%s\tDone", file)); birthToPaths = Relation.of(new TreeMap>(), TreeSet.class); pathToBirthCurrentPrevious = new HashMap<>(); - for (String xpath : files[0]) { + for (String xpath : files[0].iterableDefault()) { xpath = xpath.intern(); if (xpath.contains("[@type=\"ar\"]")) { int debug = 0; diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateCasingChart.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateCasingChart.java index c1648b609df..89617f0948c 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateCasingChart.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateCasingChart.java @@ -114,7 +114,7 @@ public static void main(String[] args) { Level level = StandardCodes.make().getLocaleCoverageLevel("cldr", locale); boolean hasCasedLetters = changesUpper.containsSome(exemplars); Set items = new LinkedHashSet<>(); - cldrFile.iterator("//ldml/contextTransforms").forEachRemaining(items::add); + cldrFile.iteratorWithoutExtras("//ldml/contextTransforms").forEachRemaining(items::add); if (!hasCasedLetters) { if (items.size() != 0) { System.out.println(locale + "Uncased language has context!!!"); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateChangeChart.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateChangeChart.java index ee549e29290..1b88291f9a5 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateChangeChart.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateChangeChart.java @@ -76,7 +76,7 @@ public static void main(String[] args) throws IOException { counter.add(s, 0); // just to have values } - for (String path : oldFile) { + for (String path : oldFile.iterableDefault()) { Level level = coverage.getCoverageLevel(path, locale); if (level.compareTo(Level.MODERN) > 0) { continue; diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateComparison.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateComparison.java index ef14f1e7f7c..5266b97f3e8 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateComparison.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateComparison.java @@ -178,11 +178,11 @@ public static void main(String[] args) throws IOException { Set paths; try { paths = new HashSet<>(); - oldFile.forEach(paths::add); + oldFile.iterableDefault().forEach(paths::add); if (oldList.contains(locale)) { paths.addAll(oldFile.getExtraPaths()); } - newFile.forEach(paths::add); + newFile.iterableDefault().forEach(paths::add); if (newList.contains(locale)) { paths.addAll(newFile.getExtraPaths()); } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateCoverageLevels.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateCoverageLevels.java index f6be968132a..e3199b72d0b 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateCoverageLevels.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateCoverageLevels.java @@ -105,7 +105,7 @@ private static void showEnglish(PrintWriter out) throws IOException { String locale = "en"; Set sorted = Builder.with(new TreeSet()) - .addAll(cldrFile.iterator()) + .addAll(cldrFile.iteratorWithoutExtras()) .addAll(cldrFile.getExtraPaths()) .get(); Set> items = new TreeSet<>(new RowComparator()); @@ -517,7 +517,7 @@ private static void getRBNFData( Set ordinals, Set spellout, Set others) { - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (path.endsWith("/alias")) { continue; } @@ -628,7 +628,7 @@ public Boolean transform(String locale) { private static void getCollationData( String locale, CLDRFile cldrFile, Set localesFound) { - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (path.endsWith("/alias")) { continue; } @@ -665,7 +665,7 @@ private static void getMainData(String locale, LevelData levelData, CLDRFile cld Status status = new Status(); Set sorted = Builder.with(new TreeSet()) - .addAll(cldrFile.iterator()) + .addAll(cldrFile.iteratorWithoutExtras()) .addAll(cldrFile.getExtraPaths()) .get(); CoverageInfo coverageInfo = CLDRConfig.getInstance().getCoverageInfo(); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDayPeriods.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDayPeriods.java index fd17ca51383..1f35b0393ea 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDayPeriods.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDayPeriods.java @@ -85,7 +85,7 @@ static Map getLocalizations(CLDRFile localeFile) { Map result = new TreeMap<>(); final String dayPeriodLocalization = "//ldml/dates/calendars/calendar[@type=\"gregorian\"]/dayPeriods/dayPeriodContext[@type=\"stand-alone\"]/dayPeriodWidth[@type=\"wide\"]"; // [@type=\"stand-alone\"]/dayPeriodWidth[@type=\"wide\"]" - for (String path2 : With.in(localeFile.iterator())) { + for (String path2 : With.in(localeFile.iteratorWithoutExtras())) { if (!path2.startsWith(dayPeriodLocalization) || path2.endsWith("/alias")) { continue; } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDerivedAnnotations.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDerivedAnnotations.java index e9343f996e1..4d1317aff4d 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDerivedAnnotations.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDerivedAnnotations.java @@ -244,7 +244,7 @@ public static void main(String[] args) throws IOException { CLDRFile cldrFileResolved = factory.make(locale, true); Set toRemove = new TreeSet<>(); // TreeSet just makes debugging easier boolean gotOne = false; - for (String xpath : cldrFileUnresolved) { + for (String xpath : cldrFileUnresolved.iterableDefault()) { if (xpath.startsWith("//ldml/identity")) { continue; } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateEnglishChanged.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateEnglishChanged.java index 5409d884b4f..796eee46f62 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateEnglishChanged.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateEnglishChanged.java @@ -53,8 +53,8 @@ public static void main(String[] args) { CLDRFile englishLastRelease = factoryLastRelease.make("en", true); Set paths = new TreeSet<>(); - With.in(englishTrunk).toCollection(paths); - With.in(englishLastRelease).toCollection(paths); + With.in(englishTrunk.iterableDefault()).toCollection(paths); + With.in(englishLastRelease.iterableDefault()).toCollection(paths); PathStarrer starrer = new PathStarrer(); final String placeholder = "×"; starrer.setSubstitutionPattern(placeholder); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateEnums.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateEnums.java index 25bbca99bd8..29263bd44d4 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateEnums.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateEnums.java @@ -439,7 +439,8 @@ public void loadCLDRData() throws IOException { unlimitedCurrencyCodes = Relation.of(new TreeMap>(), TreeSet.class, null); for (Iterator it = - supplementalData.iterator("//supplementalData/currencyData/region"); + supplementalData.iteratorWithoutExtras( + "//supplementalData/currencyData/region"); it.hasNext(); ) { String path = it.next(); XPathParts parts = XPathParts.getFrozenInstance(path); @@ -508,7 +509,8 @@ public void loadCLDRData() throws IOException { public void getContainment() { // for (Iterator it = - supplementalData.iterator("//supplementalData/territoryContainment/group"); + supplementalData.iteratorWithoutExtras( + "//supplementalData/territoryContainment/group"); it.hasNext(); ) { String path = it.next(); String fullPath = supplementalData.getFullXPath(path); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateExampleDependencies.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateExampleDependencies.java index b35dc300502..6e1ccc4482e 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateExampleDependencies.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateExampleDependencies.java @@ -84,7 +84,7 @@ private void addDependenciesForLocale(Multimap dependencies, Str cldrFile.disableCaching(); Set paths = new TreeSet<>(cldrFile.getComparator()); - cldrFile.forEach(paths::add); // time-consuming + cldrFile.iterableDefault().forEach(paths::add); // time-consuming ExampleGenerator egTest = new ExampleGenerator(cldrFile, englishFile); // Caching MUST be disabled for egTest.ICUServiceBuilder to prevent some dependencies from diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateG2xG2.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateG2xG2.java index 1adbaa4a0d2..7b45f29dc03 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateG2xG2.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateG2xG2.java @@ -406,7 +406,7 @@ private static List getCurrency(String territory) { territory_currency = new TreeMap<>(); Factory cldrFactory = Factory.make(CLDRPaths.MAIN_DIRECTORY, ".*"); CLDRFile supp = cldrFactory.make(CLDRFile.SUPPLEMENTAL_NAME, false); - for (String path : supp) { + for (String path : supp.iterableDefault()) { if (path.indexOf("/currencyData") >= 0) { // // diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateNumberingSystemAliases.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateNumberingSystemAliases.java index f5915db41a1..a9ddce1f36d 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateNumberingSystemAliases.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateNumberingSystemAliases.java @@ -79,7 +79,7 @@ public static Map, String> getMissingRootNumberingSystems() xpp.setElement(-1, element); xpp.setAttribute(-1, "numberSystem", ns); final String basePath = xpp.toString(); - if (!root.iterator(basePath).hasNext()) { + if (!root.iteratorWithoutExtras(basePath).hasNext()) { missing.put(Pair.of(ns, element), basePath); } } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateProductionData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateProductionData.java index 83e03d9e2e2..147bd9dbbb7 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateProductionData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateProductionData.java @@ -347,7 +347,8 @@ private static boolean copyFilesAndReturnIsEmpty( boolean debugLocale = localeId.equals("pt"); ImmutableSet sortedPaths = - ImmutableSortedSet.copyOf(cldrFileUnresolved); // sort for debugging + ImmutableSortedSet.copyOf( + cldrFileUnresolved.iterableDefault()); // sort for debugging for (String xpath : sortedPaths) { if (xpath.startsWith("//ldml/identity")) { @@ -511,7 +512,7 @@ private static boolean copyFilesAndReturnIsEmpty( // double-check results int count = 0; - for (String xpath : outCldrFile) { + for (String xpath : outCldrFile.iterableDefault()) { if (debugPath != null && localeId.equals(debugLocale) && xpath.equals(debugPath)) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateSidewaysView.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateSidewaysView.java index 913a2ad627f..701711c8954 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateSidewaysView.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateSidewaysView.java @@ -720,7 +720,7 @@ private static void loadInformation(Factory cldrFactory) { continue; } if (cldrFile.isNonInheriting()) continue; - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (pathMatcher != null && !pathMatcher.reset(path).matches()) { continue; } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateTempDateData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateTempDateData.java index 1e294834380..39fe5f6a187 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateTempDateData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateTempDateData.java @@ -36,7 +36,8 @@ public static void main(String[] args) throws IOException { System.out.println(locale); boolean gotOne = false; for (Iterator it2 = - file.iterator("//ldml/dates/calendars/calendar[@type=\"gregorian\"]/"); + file.iteratorWithoutExtras( + "//ldml/dates/calendars/calendar[@type=\"gregorian\"]/"); it2.hasNext(); ) { String path = it2.next(); if (path.indexOf("dateTimeFormats/availableFormats/dateFormatItem") >= 0) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GetChanges.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GetChanges.java index 8437e67e25c..22b9d5dda3c 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GetChanges.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GetChanges.java @@ -106,7 +106,7 @@ private static void compare(String dir, CLDRFile vxmlFileResolved, CLDRFile trun int countNew = 0; int countChanged = 0; - for (String path : vxmlFileUnresolved) { + for (String path : vxmlFileUnresolved.iterableDefault()) { if (path.contains("/identity")) { continue; } @@ -240,7 +240,7 @@ private void old() { Output pathWhereFound = new Output<>(); CLDRFile englishCldrFile = trunkFactory.make("en", false); - final Set paths = ImmutableSet.copyOf(englishCldrFile.iterator()); + final Set paths = ImmutableSet.copyOf(englishCldrFile.iteratorWithoutExtras()); System.out.println("english paths: " + paths.size()); Multimap missing = TreeMultimap.create(); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListCoverageLevels.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListCoverageLevels.java index 3b518683321..0c028f239ae 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListCoverageLevels.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListCoverageLevels.java @@ -68,7 +68,7 @@ public static void main(String[] args) { CLDRFile file = mainAndAnnotationsFactory.make(locale, false); CoverageLevel2 coverageLeveler = CoverageLevel2.getInstance(locale); System.out.println(locale); - for (String path : file) { + for (String path : file.iterableDefault()) { Level level = coverageLeveler.getLevel(path); String skeleton = starrer.set(path); levelToCounter.get(level).add(skeleton); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListUnits.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListUnits.java index 1c190f0eb8c..45ff2fe58ee 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListUnits.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListUnits.java @@ -205,7 +205,8 @@ static void getDigits(CLDRFile cldrFile) { + main.getFirst().toPattern(false) + ", " + main.getSecond().toPattern(false)); - for (Iterator it = cldrFile.iterator("//ldml/numbers/otherNumberingSystems"); + for (Iterator it = + cldrFile.iteratorWithoutExtras("//ldml/numbers/otherNumberingSystems"); it.hasNext(); ) { String path = it.next(); String otherNumberingSystem = cldrFile.getWinningValue(path); @@ -286,7 +287,7 @@ public String toString() { private static Set getUnits(CLDRFile cldrFile, Task task, Map extra) { Set seen = new TreeSet<>(); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (!path.contains("/unit")) { continue; } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/Misc.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/Misc.java index b028ca6f0a2..527a4fbc8c6 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/Misc.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/Misc.java @@ -1128,7 +1128,7 @@ private static void printSupplementalData(String locale) throws IOException { CLDRFile english = cldrFactory.make("en", true); Collator col = Collator.getInstance(new ULocale(locale)); CLDRFile supp = cldrFactory.make(CLDRFile.SUPPLEMENTAL_NAME, false); - for (Iterator it = supp.iterator(); it.hasNext(); ) { + for (Iterator it = supp.iteratorWithoutExtras(); it.hasNext(); ) { String path = it.next(); XPathParts parts = XPathParts.getFrozenInstance(supp.getFullXPath(path)); Map m = parts.findAttributes("language"); @@ -1136,7 +1136,7 @@ private static void printSupplementalData(String locale) throws IOException { // territories Map> groups = new TreeMap<>(); - for (Iterator it = supp.iterator(); it.hasNext(); ) { + for (Iterator it = supp.iteratorWithoutExtras(); it.hasNext(); ) { String path = it.next(); XPathParts parts = XPathParts.getFrozenInstance(supp.getFullXPath(path)); Map m = parts.findAttributes("territoryContainment"); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/PivotData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/PivotData.java index 1f420d5527d..139caf1c94d 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/PivotData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/PivotData.java @@ -68,7 +68,8 @@ private void pivotGroup(Factory cldrFactory, Set condition throws IOException { CLDRFile supplementalMetadata = cldrFactory.make("supplementalMetadata", false); if (false) - for (Iterator it = supplementalMetadata.iterator(); it.hasNext(); ) { + for (Iterator it = supplementalMetadata.iteratorWithoutExtras(); + it.hasNext(); ) { System.out.println(it.next()); } String defaultContentList = @@ -131,7 +132,7 @@ public int writePivot(String localeID) throws IOException { throw new IllegalArgumentException("File cannot be completely aliased: " + localeID); } - for (Iterator it = me.iterator(); it.hasNext(); ) { + for (Iterator it = me.iteratorWithoutExtras(); it.hasNext(); ) { String path = it.next(); if (path.startsWith("//ldml/identity")) continue; String fullPath = me.getFullXPath(path); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/PluralMinimalPairs.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/PluralMinimalPairs.java index db6bb3c10c4..e0016488af3 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/PluralMinimalPairs.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/PluralMinimalPairs.java @@ -34,7 +34,8 @@ public static PluralMinimalPairs getInstance(String ulocale) { try { samplePatterns = new PluralMinimalPairs(); CLDRFile cldrFile = factory.make(ulocale, true); - for (Iterator it = cldrFile.iterator("//ldml/numbers/minimalPairs/"); + for (Iterator it = + cldrFile.iteratorWithoutExtras("//ldml/numbers/minimalPairs/"); it.hasNext(); ) { String path = it.next(); String foundLocale = cldrFile.getSourceLocaleID(path, null); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/PrepareRootAnnotations.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/PrepareRootAnnotations.java index 275118fd4c9..769624dae2f 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/PrepareRootAnnotations.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/PrepareRootAnnotations.java @@ -18,7 +18,7 @@ public static void main(String[] args) throws IOException { Factory factoryAnnotations = SimpleFactory.make(CLDRPaths.ANNOTATIONS_DIRECTORY, ".*"); CLDRFile oldAnnotations = factoryAnnotations.make("root", false); UnicodeMap oldValues = new UnicodeMap<>(); - for (String path : oldAnnotations) { + for (String path : oldAnnotations.iterableDefault()) { XPathParts parts = XPathParts.getFrozenInstance(path); if (parts.getElement(1).equals("identity")) { continue; diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/RemoveEmptyCldrFiles.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/RemoveEmptyCldrFiles.java index 2e2811ed28a..da052fd7cf6 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/RemoveEmptyCldrFiles.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/RemoveEmptyCldrFiles.java @@ -26,7 +26,7 @@ public static void main(String[] args) { } private static boolean isEmpty(CLDRFile cldrFile) { - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (!path.contains("/identity")) { return false; } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowChildren.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowChildren.java index 483ac610e93..06cb819581b 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowChildren.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowChildren.java @@ -48,7 +48,7 @@ public static void main(String[] args) { Set children = entry.getValue(); for (String child : children) { CLDRFile file = cldrFactory.make(child, false); - for (String path : file) { + for (String path : file.iterableDefault()) { if (path.startsWith("//ldml/identity") || path.endsWith("/alias") || path.endsWith("/commonlyUsed")) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowCoverageLevels.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowCoverageLevels.java index 9f87a32191a..88e0d019632 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowCoverageLevels.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowCoverageLevels.java @@ -27,7 +27,7 @@ public static void main(String[] args) { CoverageInfo coverageInfo = CLDRConfig.getInstance().getCoverageInfo(); for (String locale : testInfo.getCldrFactory().getAvailable()) { CLDRFile cldrFileToCheck = testInfo.getCldrFactory().make(locale, true); - for (String path : cldrFileToCheck) { + for (String path : cldrFileToCheck.iterableDefault()) { String fullPath = cldrFileToCheck.getFullXPath(path); if (fullPath == null) { continue; diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowData.java index 9fa348f2aed..8d03e06d5a1 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowData.java @@ -187,13 +187,13 @@ public static void main(String[] args) throws Exception { // get all of the paths Set allPaths = new HashSet<>(); - file.forEach(allPaths::add); + file.iterableDefault().forEach(allPaths::add); if (!locale.equals("root")) { for (String childLocale : children) { CLDRFile childCldrFile = cldrFactory.make(childLocale, false); if (childCldrFile != null) { - childCldrFile.forEach(allPaths::add); + childCldrFile.iterableDefault().forEach(allPaths::add); } sublocales.put(childLocale, childCldrFile); } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowInconsistentAvailable.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowInconsistentAvailable.java index 0ab5db231c1..ff36751775e 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowInconsistentAvailable.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowInconsistentAvailable.java @@ -160,7 +160,7 @@ private static void getTCPaths( CLDRFile cldrFile = f.make(locale, false); DateIntervalInfo fInfo = new DateIntervalInfo(new ULocale(locale)).freeze(); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { String value = cldrFile.getStringValue(path); if (value == null || value.isBlank() || value.equals("↑↑↑")) { continue; @@ -211,7 +211,7 @@ private static void getRootPaths() { Set calendars = new TreeSet<>(); final CLDRFile root = CONFIG.getRoot(); - for (String path : root) { + for (String path : root.iterableDefault()) { XPathParts parts = XPathParts.getFrozenInstance(path); if (!parts.getElement(-1).equals("dateFormatItem")) { continue; @@ -276,7 +276,7 @@ static void showInconsistenciesInLocale(String locale) { Multimap sorted = TreeMultimap.create(); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { XPathParts parts = XPathParts.getFrozenInstance(path); if (!parts.getElement(-1).equals("dateFormatItem")) { continue; diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLanguages.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLanguages.java index fb765086efe..93299d6f2c4 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLanguages.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLanguages.java @@ -824,7 +824,7 @@ static class LanguageInfo { public LanguageInfo(Factory cldrFactory) throws IOException { CLDRFile supp = cldrFactory.make(CLDRFile.SUPPLEMENTAL_NAME, false); - for (Iterator it = supp.iterator(); it.hasNext(); ) { + for (Iterator it = supp.iteratorWithoutExtras(); it.hasNext(); ) { String path = it.next(); String fullPath = supp.getFullXPath(path); if (fullPath == null) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowPathHeaderDescriptions.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowPathHeaderDescriptions.java index ae8116f5f78..7499cf2178d 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowPathHeaderDescriptions.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowPathHeaderDescriptions.java @@ -94,7 +94,7 @@ public static void showDescriptions(String[] args) { Set urls = new TreeSet<>(); - for (String path : english) { + for (String path : english.iterableDefault()) { PathHeader pathHeader = phf.fromPath(path); String pdx = pathDescriptionFactory.getRawDescription(path, null); String url; diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowRegionalVariants.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowRegionalVariants.java index a58e0844aaa..2e37688da66 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowRegionalVariants.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowRegionalVariants.java @@ -136,7 +136,7 @@ public static void main(String[] args) throws IOException { // childDiffs.add(child, 0); // make sure it shows up String childString = child.toString(); CLDRFile childFile = FACTORY.make(childString, false, DraftStatus.contributed); - for (String path : childFile) { + for (String path : childFile.iterableDefault()) { if (SKIP_SUPPRESSED_PATHS) { if (path.contains("/currency") && path.contains("/symbol")) { continue; diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowStarredCoverage.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowStarredCoverage.java index b248e771f14..87f4e244e6f 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowStarredCoverage.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowStarredCoverage.java @@ -386,7 +386,7 @@ private static void doLdml( Counter counter = new Counter<>(); TreeSet pathHeaders = new TreeSet<>(); - for (String path : file) { + for (String path : file.iterableDefault()) { if (path.endsWith("/alias") || path.startsWith("//ldml/identity")) { continue; } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/VettingAdder.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/VettingAdder.java index e445cb1cca2..7ec594ac841 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/VettingAdder.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/VettingAdder.java @@ -140,7 +140,7 @@ public void incorporateVetting(String locale, String targetDir) throws IOExcepti fixXML(dir, locale + ".xml", dir, fixedLocale); CLDRFile cldr = SimpleFactory.makeFromFile(dir + fixedLocale, locale, DraftStatus.approved); - for (Iterator it3 = cldr.iterator(); it3.hasNext(); ) { + for (Iterator it3 = cldr.iteratorWithoutExtras(); it3.hasNext(); ) { String path = it3.next(); String value = cldr.getStringValue(path); String fullPath = cldr.getFullXPath(path); @@ -285,7 +285,7 @@ public void showFiles(Factory cldrFactory, String targetDir) throws IOException for (Iterator it = availableLocales.iterator(); it.hasNext(); ) { String locale = it.next(); CLDRFile cldr = cldrFactory.make(locale, false); - for (Iterator it2 = cldr.iterator(); it2.hasNext(); ) { + for (Iterator it2 = cldr.iteratorWithoutExtras(); it2.hasNext(); ) { String path = it2.next(); String fullPath = cldr.getFullXPath(path); if (fullPath.indexOf("[@draft=") >= 0) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/resolver/ResolverUtils.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/resolver/ResolverUtils.java index dd9bcad650b..df297355514 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/resolver/ResolverUtils.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/resolver/ResolverUtils.java @@ -28,13 +28,13 @@ private ResolverUtils() {} * Get the set of paths with non-null values from a CLDR file (including all extra paths). * * @param file the CLDRFile from which to extract paths - * @return a Set containing all the paths returned by {@link CLDRFile#iterator()}, plus those - * from {@link CLDRFile#getExtraPaths(java.util.Collection)} + * @return a Set containing all the paths returned by {@link CLDRFile#iteratorWithoutExtras()}, + * plus those from {@link CLDRFile#getExtraPaths(java.util.Collection)} */ public static Set getAllPaths(CLDRFile file) { String locale = file.getLocaleID(); Set paths = new HashSet<>(); - for (String path : file) { + for (String path : file.iterableDefault()) { paths.add(path); } for (String path : file.getExtraPaths()) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/CLDRFile.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/CLDRFile.java index b0f8107cfa8..24f2ee56c86 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/CLDRFile.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/CLDRFile.java @@ -98,7 +98,7 @@ * http://java.sun.com/j2se/1.4.2/docs/api/org/xml/sax/DTDHandler.html */ -public class CLDRFile implements Freezable, Iterable, LocaleStringProvider { +public class CLDRFile implements Freezable, LocaleStringProvider { private static final ImmutableSet casesNominativeOnly = ImmutableSet.of(GrammaticalFeature.grammaticalCase.getDefault(null)); @@ -548,7 +548,7 @@ public CLDRFile cloneAsThawed() { /** Prints the contents of the file (the xpaths/values) to the console. */ public CLDRFile show() { - for (Iterator it2 = iterator(); it2.hasNext(); ) { + for (Iterator it2 = iteratorWithoutExtras(); it2.hasNext(); ) { String xpath = it2.next(); System.out.println(getFullXPath(xpath) + " =>\t" + getStringValue(xpath)); } @@ -935,7 +935,7 @@ public CLDRFile putAll(CLDRFile other, int conflict_resolution) { // only replace draft items! // this is either an item with draft in the fullpath // or an item with draft and alt in the full path - for (Iterator it = other.iterator(); it.hasNext(); ) { + for (Iterator it = other.iteratorWithoutExtras(); it.hasNext(); ) { String cpath = it.next(); cpath = getNondraftNonaltXPath(cpath); String newValue = other.getStringValue(cpath); @@ -968,7 +968,7 @@ public CLDRFile putAll(CLDRFile other, int conflict_resolution) { dataSource.putValueAtPath(newFullPath, newValue); } } else if (conflict_resolution == MERGE_ADD_ALTERNATE) { - for (Iterator it = other.iterator(); it.hasNext(); ) { + for (Iterator it = other.iteratorWithoutExtras(); it.hasNext(); ) { String key = it.next(); String otherValue = other.getStringValue(key); String myValue = dataSource.getValueAtPath(key); @@ -1125,7 +1125,7 @@ public CLDRFile removeDuplicates( removedItems.clear(); } Set checked = new HashSet<>(); - for (Iterator it = iterator(); + for (Iterator it = iteratorWithoutExtras(); it.hasNext(); ) { // see what items we have that the other also has String curXpath = it.next(); boolean logicDuplicate = true; @@ -1246,7 +1246,7 @@ public String getLocaleID() { */ public String getLocaleIDFromIdentity() { ULocale.Builder lb = new ULocale.Builder(); - for (Iterator i = iterator("//ldml/identity/"); i.hasNext(); ) { + for (Iterator i = iteratorWithoutExtras("//ldml/identity/"); i.hasNext(); ) { XPathParts xpp = XPathParts.getFrozenInstance(i.next()); String k = xpp.getElement(-1); String v = xpp.getAttributeValue(-1, "type"); @@ -1462,20 +1462,19 @@ public static Set getMatchingXMLFiles(File sourceDirs[], Matcher m) { return s; } - @Override - public Iterator iterator() { + public Iterator iteratorWithoutExtras() { return dataSource.iterator(); } - public synchronized Iterator iterator(String prefix) { + public synchronized Iterator iteratorWithoutExtras(String prefix) { return dataSource.iterator(prefix); } - public Iterator iterator(Matcher pathFilter) { + public Iterator iteratorWithoutExtras(Matcher pathFilter) { return dataSource.iterator(pathFilter); } - public Iterator iterator(String prefix, Comparator comparator) { + public Iterator iteratorWithoutExtras(String prefix, Comparator comparator) { Iterator it = (prefix == null || prefix.length() == 0) ? dataSource.iterator() @@ -1486,6 +1485,20 @@ public Iterator iterator(String prefix, Comparator comparator) { return orderedSet.iterator(); } + private final boolean DEFAULT_ITERABLE_INCLUDES_EXTRAS = true; + + public Iterable iterableDefault() { + if (DEFAULT_ITERABLE_INCLUDES_EXTRAS) { + return fullIterable(); + } else { + return iterableWithoutExtras(); + } + } + + public Iterable iterableWithoutExtras() { + return () -> this.iteratorWithoutExtras(); + } + public Iterable fullIterable() { return new FullIterable(this); } @@ -1497,7 +1510,7 @@ public static class FullIterable implements Iterable, SimpleIterator getAvailableIterator(NameType type) { String s = type.getPathStart(); - return iterator(s); + return iteratorWithoutExtras(s); } static final Relation, String> bcp47AliasMap = @@ -2599,7 +2612,7 @@ public UnicodeSet getExemplarsNumeric(String numberingSystem) { } public String getCurrentMetazone(String zone) { - for (Iterator it2 = iterator(); it2.hasNext(); ) { + for (Iterator it2 = iteratorWithoutExtras(); it2.hasNext(); ) { String xpath = it2.next(); if (xpath.startsWith( "//ldml/dates/timeZoneNames/zone[@type=\"" + zone + "\"]/usesMetazone")) { @@ -2839,7 +2852,7 @@ public String getFullXPath(String path, boolean ignoreOtherLeafAttributes) { parts.toString(parts.size() - 1) + "/" + parts.getElement(parts.size() - 1); // trim final element - for (Iterator it = iterator(base); it.hasNext(); ) { + for (Iterator it = iteratorWithoutExtras(base); it.hasNext(); ) { String otherPath = it.next(); XPathParts other = XPathParts.getFrozenInstance(otherPath); if (other.size() != parts.size()) { @@ -3045,7 +3058,7 @@ public TestUser(CLDRFile baseFile, String user, boolean resolved) { new HashMap>(), TreeSet.class, new WinningComparator(user)); - for (String path : baseFile) { + for (String path : baseFile.iterableDefault()) { String newPath = getNondraftNonaltXPath(path); pathMap.put(newPath, path); } @@ -3081,7 +3094,7 @@ public String getWinningPath(String path) { public Collection getExtraPaths() { Set toAddTo = new HashSet<>(); toAddTo.addAll(getRawExtraPaths()); - for (String path : this) { + for (String path : this.iterableWithoutExtras()) { toAddTo.remove(path); } return toAddTo; @@ -3165,7 +3178,8 @@ private List getRawExtraPathsPrivate() { Set pluralCountsRaw = plurals.getCounts(); if (pluralCountsRaw.size() != 1) { // we get all the root paths with count - addPluralCounts(toAddTo, pluralCounts, pluralCountsRaw, this); + addPluralCounts( + toAddTo, pluralCounts, pluralCountsRaw, this.iterableWithoutExtras()); } } // dayPeriods @@ -3532,7 +3546,7 @@ public boolean isNotRoot(String distinguishedPath) { } public boolean isAliasedAtTopLevel() { - return iterator("//ldml/alias").hasNext(); + return this.iteratorWithoutExtras("//ldml/alias").hasNext(); } public static Comparator getComparator(DtdType dtdType) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/CharacterFallbacks.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/CharacterFallbacks.java index 0498fafc21e..719003d26b0 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/CharacterFallbacks.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/CharacterFallbacks.java @@ -25,7 +25,8 @@ private CharacterFallbacks() { DtdData.getInstance(DtdType.supplementalData).getDtdComparator(null); for (Iterator it = - characterFallbacks.iterator("//supplementalData/characters/", comp); + characterFallbacks.iteratorWithoutExtras( + "//supplementalData/characters/", comp); it.hasNext(); ) { String path = it.next(); String fullPath = characterFallbacks.getFullXPath(path); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/DateTimeFormats.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/DateTimeFormats.java index 12bc9747055..fe3ae568779 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/DateTimeFormats.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/DateTimeFormats.java @@ -232,7 +232,7 @@ public DateTimeFormats set(CLDRFile file, String calendarID, boolean useStock) { // appendItems result.setAppendItemFormat(getAppendFormatNumber(formatName), value); for (String path : With.in( - file.iterator( + file.iteratorWithoutExtras( "//ldml/dates/calendars/calendar[@type=\"" + calendarID + "\"]/dateTimeFormats/appendItems/appendItem"))) { @@ -248,7 +248,7 @@ public DateTimeFormats set(CLDRFile file, String calendarID, boolean useStock) { // field names result.setAppendItemName(i, value); // ldml/dates/fields/field[@type="day"]/displayName - for (String path : With.in(file.iterator("//ldml/dates/fields/field"))) { + for (String path : With.in(file.iteratorWithoutExtras("//ldml/dates/fields/field"))) { if (!path.contains("displayName")) { continue; } @@ -265,7 +265,7 @@ public DateTimeFormats set(CLDRFile file, String calendarID, boolean useStock) { for (String path : With.in( - file.iterator( + file.iteratorWithoutExtras( "//ldml/dates/calendars/calendar[@type=\"" + calendarID + "\"]/dateTimeFormats/availableFormats/dateFormatItem"))) { @@ -288,7 +288,7 @@ public DateTimeFormats set(CLDRFile file, String calendarID, boolean useStock) { // ldml/dates/calendars/calendar[@type=\"gregorian\"]/dateTimeFormats/intervalFormats/intervalFormatItem[@id=\"yMMMEd\"]/greatestDifference[@id=\"d\"] for (String path : With.in( - file.iterator( + file.iteratorWithoutExtras( "//ldml/dates/calendars/calendar[@type=\"" + calendarID + "\"]/dateTimeFormats/intervalFormats/intervalFormatItem"))) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/DayPeriodConverter.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/DayPeriodConverter.java index 2ab0f39eae3..d4a99ae657d 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/DayPeriodConverter.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/DayPeriodConverter.java @@ -159,7 +159,7 @@ private static void generateFieldNames() { // System.out.println("\t"); // System.out.println("\t\t"); CLDRFile cldrFile = factory.make(locale, false); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (path.endsWith("/alias")) { continue; } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/DtdDataCheck.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/DtdDataCheck.java index ecfbe3a3096..d1776f97773 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/DtdDataCheck.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/DtdDataCheck.java @@ -220,7 +220,7 @@ public static void main(String[] args) throws IOException { Comparator comp = dtdData.getDtdComparator(null); CLDRFile test = ToolConfig.getToolInstance().getEnglish(); Set sorted = new TreeSet(test.getComparator()); - test.forEach(sorted::add); + test.iterableDefault().forEach(sorted::add); String[] sortedArray = sorted.toArray(new String[sorted.size()]); // compare for identity diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/ExtractCollationRules.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/ExtractCollationRules.java index 03ab51f3d7f..af11f09cb19 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/ExtractCollationRules.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/ExtractCollationRules.java @@ -26,7 +26,7 @@ public ExtractCollationRules set(CLDRFile file) { String context = null; - for (Iterator it = file.iterator("//ldml/collations", file.getComparator()); + for (Iterator it = file.iteratorWithoutExtras("//ldml/collations", file.getComparator()); it.hasNext(); ) { // System.out.print(rules.substring(lastLen, rules.length())); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/GrammarInfo.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/GrammarInfo.java index 41779eaba3d..b4f65dd3e03 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/GrammarInfo.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/GrammarInfo.java @@ -779,7 +779,8 @@ static class UnitsToAddGrammar { for (String path : With.in( config.getRoot() - .iterator("//ldml/units/unitLength[@type=\"short\"]/unit"))) { + .iteratorWithoutExtras( + "//ldml/units/unitLength[@type=\"short\"]/unit"))) { XPathParts parts = XPathParts.getFrozenInstance(path); String unit = parts.getAttributeValue(3, "type"); // Add simple units diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/TestUtilities.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/TestUtilities.java index 156a25a92d1..fa0d71ae882 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/TestUtilities.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/TestUtilities.java @@ -149,7 +149,7 @@ private static void testExampleGenerator() throws IOException { StringBuilder result = new StringBuilder(); Relation message_paths = Relation.of(new TreeMap>(), TreeSet.class); - for (String path : english) { + for (String path : english.iterableDefault()) { String value = english.getStringValue(path); result.setLength(0); String examples = englishExampleGenerator.getExampleHtml(path, value); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/TimezoneFormatter.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/TimezoneFormatter.java index 206c0c669df..c18fdbcc709 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/TimezoneFormatter.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/TimezoneFormatter.java @@ -776,7 +776,7 @@ private void buildParsingInfo() { String countryPrefix = "//ldml/localeDisplayNames/territories/territory[@type=\""; Map localizedNonWall = new HashMap<>(); Set skipDuplicates = new HashSet<>(); - for (Iterator it = desiredLocaleFile.iterator(); it.hasNext(); ) { + for (Iterator it = desiredLocaleFile.iteratorWithoutExtras(); it.hasNext(); ) { String path = it.next(); // dumb, simple implementation if (path.startsWith(prefix)) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/personname/PersonNameFormatter.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/personname/PersonNameFormatter.java index afe53acf199..3ba86b4a2a1 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/personname/PersonNameFormatter.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/personname/PersonNameFormatter.java @@ -1916,7 +1916,7 @@ public PersonNameFormatter(CLDRFile cldrFile) { Map _localeToOrder = new TreeMap<>(); // read out the data and order it properly - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (path.startsWith("//ldml/personNames") && !path.endsWith("/alias")) { String value = cldrFile.getStringValue(path); // System.out.println(path + ",\t" + value); @@ -2130,7 +2130,7 @@ public static Map loadSampleNames(CLDRFile cldrFil new TreeMap(), new TreeMap(), String.class); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (path.startsWith("//ldml/personNames/sampleName")) { // ldml/personNames/sampleName[@item="full"]/nameField[@type="prefix"] String value = cldrFile.getStringValue(path); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/CheckYear.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/CheckYear.java index 54e99338b01..617e55c202d 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/CheckYear.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/CheckYear.java @@ -335,7 +335,7 @@ public static void gatherInfo(Factory factory, String calendarID, Map rootPaths = ImmutableSortedSet.copyOf( - factoryAnnotations.make("root", false).iterator("//ldml/annotations/")); + factoryAnnotations + .make("root", false) + .iteratorWithoutExtras("//ldml/annotations/")); CLDRFile englishAnnotations = factoryAnnotations.make("en", false); ImmutableSet englishPaths = - ImmutableSortedSet.copyOf(englishAnnotations.iterator("//ldml/annotations/")); + ImmutableSortedSet.copyOf( + englishAnnotations.iteratorWithoutExtras("//ldml/annotations/")); Set superfluous2 = setDifference(rootPaths, englishPaths); assertTrue("en contains root", superfluous2.isEmpty()); @@ -540,7 +543,9 @@ public void testSuperfluousAnnotationPaths() { for (String locale : factoryAnnotations.getAvailable()) { ImmutableSet currentPaths = ImmutableSortedSet.copyOf( - factoryAnnotations.make(locale, false).iterator("//ldml/annotations/")); + factoryAnnotations + .make(locale, false) + .iteratorWithoutExtras("//ldml/annotations/")); Set superfluous = setDifference(currentPaths, rootPaths); if (!assertTrue("root contains " + locale, superfluous.isEmpty())) { int debug = 0; @@ -647,7 +652,7 @@ public void testSymbols() { Set nonEmojiPages = expectedMap.values(); UnicodeMap> failures = new UnicodeMap<>(); PathHeader.Factory phf = PathHeader.getFactory(); - for (String path : root) { + for (String path : root.iterableDefault()) { XPathParts parts = XPathParts.getFrozenInstance(path); String cp = parts.getAttributeValue(-1, "cp"); if (cp == null) { diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBCP47.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBCP47.java index 35243cfab37..43fc9d7e421 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBCP47.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBCP47.java @@ -51,13 +51,15 @@ public static void main(String[] args) { new TreeMap(), new TreeMap(), String.class); static { - for (String path : With.in(ENGLISH.iterator("//ldml/localeDisplayNames/keys/key"))) { + for (String path : + With.in(ENGLISH.iteratorWithoutExtras("//ldml/localeDisplayNames/keys/key"))) { XPathParts parts = XPathParts.getFrozenInstance(path); String value = ENGLISH.getStringValue(path); String key = parts.getAttributeValue(-1, "type"); keyTypeTranslations.put(key, "", value); } - for (String path : With.in(ENGLISH.iterator("//ldml/localeDisplayNames/types/type"))) { + for (String path : + With.in(ENGLISH.iteratorWithoutExtras("//ldml/localeDisplayNames/types/type"))) { XPathParts parts = XPathParts.getFrozenInstance(path); String value = ENGLISH.getStringValue(path); String key = parts.getAttributeValue(-1, "key"); @@ -66,7 +68,7 @@ public static void main(String[] args) { } for (String path : With.in( - ENGLISH.iterator( + ENGLISH.iteratorWithoutExtras( "//ldml/localeDisplayNames/transformNames/transformName"))) { XPathParts parts = XPathParts.getFrozenInstance(path); String value = ENGLISH.getStringValue(path); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBasic.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBasic.java index f95904cf253..b15af425b8c 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBasic.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBasic.java @@ -205,7 +205,7 @@ && logKnownIssue( ) { CLDRFile cldrfile = CLDRFile.loadFromFile(fileName, "temp", DraftStatus.unconfirmed); - for (String xpath : cldrfile) { + for (String xpath : cldrfile.iterableDefault()) { String fullPath = cldrfile.getFullXPath(xpath); if (fullPath == null) { fullPath = cldrfile.getFullXPath(xpath); @@ -426,7 +426,7 @@ public void TestCurrencyFallback() { .freeze(); UnicodeSet badSoFar = new UnicodeSet(); - for (Iterator it = file.iterator(); it.hasNext(); ) { + for (Iterator it = file.iteratorWithoutExtras(); it.hasNext(); ) { String path = it.next(); if (path.endsWith("/alias")) { continue; @@ -545,7 +545,7 @@ public void TestAbstractPaths() { if (file.isNonInheriting()) continue; logln(locale + "\t-\t" + english.nameGetter().getNameFromIdentifier(locale)); - for (Iterator it = file.iterator(); it.hasNext(); ) { + for (Iterator it = file.iteratorWithoutExtras(); it.hasNext(); ) { String path = it.next(); if (path.endsWith("/alias")) { continue; @@ -621,7 +621,7 @@ public void TestPaths() { logln(locale + "\t-\t" + english.nameGetter().getNameFromIdentifier(locale)); - for (Iterator it = file.iterator(); it.hasNext(); ) { + for (Iterator it = file.iteratorWithoutExtras(); it.hasNext(); ) { String path = it.next(); if (dtdType == null) { dtdType = DtdType.fromPath(path); @@ -805,7 +805,7 @@ public void TestDefaultContents() { continue; } // we check that the default content locale is always empty - for (Iterator it = cldrFile.iterator(); it.hasNext(); ) { + for (Iterator it = cldrFile.iteratorWithoutExtras(); it.hasNext(); ) { String path = it.next(); if (path.contains("/identity")) { continue; @@ -907,7 +907,7 @@ private String highestShared(String parent, Set children) { PathHeader.Factory phf = PathHeader.getFactory(testInfo.getEnglish()); for (String child : children) { CLDRFile cldrFile = testInfo.getCLDRFile(child, false); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (path.contains("/identity")) { continue; } @@ -1047,7 +1047,7 @@ private void showDifferences(String locale) { final String localeParent = LocaleIDParser.getParent(locale); CLDRFile parentFile = testInfo.getCLDRFile(localeParent, true); int funnyCount = 0; - for (Iterator it = cldrFile.iterator("", cldrFile.getComparator()); + for (Iterator it = cldrFile.iteratorWithoutExtras("", cldrFile.getComparator()); it.hasNext(); ) { String path = it.next(); if (path.contains("/identity")) { diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRFile.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRFile.java index 401e3cd0e3c..9c49d83e0c5 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRFile.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRFile.java @@ -447,7 +447,7 @@ public void testExtraPaths() { public void checkLocale(CLDRFile cldr) { Matcher m = PatternCache.get("gregorian.*eras").matcher(""); - for (Iterator it = cldr.iterator("", new UTF16.StringComparator()); + for (Iterator it = cldr.iteratorWithoutExtras("", new UTF16.StringComparator()); it.hasNext(); ) { String path = it.next(); if (m.reset(path).find() && !path.contains("alias")) { @@ -496,7 +496,7 @@ public void testSimple() { deltaTime = System.currentTimeMillis(); for (int j = 0; j < 2; ++j) { - for (Iterator it = english.iterator(); it.hasNext(); ) { + for (Iterator it = english.iteratorWithoutExtras(); it.hasNext(); ) { String dpath = it.next(); String value = english.getStringValue(dpath); Set paths = english.getPathsWithValue(value, "", null, null); @@ -908,7 +908,7 @@ private void put(Map> aToBToC, A a, B b, C c) { public void TestSwissHighGerman() { CLDRFile swissHighGerman = testInfo.getCommonSeedExemplarsFactory().make("de_CH", true); - for (String xpath : swissHighGerman) { + for (String xpath : swissHighGerman.iterableDefault()) { if (xpath.equals("//ldml/characters/exemplarCharacters[@type=\"auxiliary\"]")) { continue; } @@ -930,7 +930,7 @@ public void TestExtraPaths() { PathHeader.Factory pathHeaderFactory = PathHeader.getFactory(testInfo.getEnglish()); Status status = new Status(); - for (String xpath : af) { + for (String xpath : af.iterableDefault()) { if (missing.contains(xpath)) { String value = af.getStringValue(xpath); String source = af.getSourceLocaleID(xpath, status); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckAltOnly.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckAltOnly.java index d785ad33f12..82756f69e58 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckAltOnly.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckAltOnly.java @@ -176,7 +176,7 @@ private void checkFile(TestFactory factory, String localeId, String... expectedE possibleErrors.clear(); } Map> found = new HashMap<>(); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { String value = cldrFile.getStringValue(path); ch.check(path, path, value, options, possibleErrors); if (!possibleErrors.isEmpty()) { diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckCLDR.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckCLDR.java index e52cd0f40e5..d8a2cdddd81 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckCLDR.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckCLDR.java @@ -122,7 +122,7 @@ public static void TestCheckConsistentCasing() { List possibleErrors = new ArrayList<>(); final CLDRFile english = testInfo.getEnglish(); c.setCldrFileToCheck(english, new CheckCLDR.Options(options), possibleErrors); - for (String path : english) { + for (String path : english.iterableDefault()) { c.check( path, english.getFullXPath(path), @@ -156,7 +156,7 @@ public void TestTestCache() { List possibleErrors = new ArrayList<>(); int pathCount = 0; double startTime = System.currentTimeMillis(); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { String fullPath = cldrFile.getFullXPath(path); String value = cldrFile.getStringValue(path); bundle.check(fullPath, possibleErrors, value); @@ -515,7 +515,7 @@ public void checkLocale( CLDRFile patched = nativeFile; // new CLDRFile(override); PathHeader.Factory pathHeaderFactory = PathHeader.getFactory(english); Set sorted = new TreeSet<>(); - for (String path : patched) { + for (String path : patched.iterableDefault()) { final PathHeader pathHeader = pathHeaderFactory.fromPath(path); if (pathHeader != null) { sorted.add(pathHeader); @@ -1073,7 +1073,7 @@ public void TestShowRowAction() { CLDRFile cldrFileUnresolved = testInfo.getCldrFactory().make(locale, false); Set sorted = new TreeSet<>(); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { PathHeader ph = pathHeaderFactory.fromPath(path); sorted.add(ph); } diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckDisplayCollisions.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckDisplayCollisions.java index 6b26c74c0c0..7d1301553fe 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckDisplayCollisions.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckDisplayCollisions.java @@ -166,7 +166,7 @@ private void checkFile( possibleErrors.clear(); } Map> found = new HashMap<>(); - for (String path : cldrFileResolved) { + for (String path : cldrFileResolved.iterableDefault()) { String value = cldrFileResolved.getStringValue(path); // System.out.println(path + "\t" + value); if (path.equals(deciLong)) { diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCldrFactory.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCldrFactory.java index cfc3d9cada4..79c3a0dddfc 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCldrFactory.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCldrFactory.java @@ -92,7 +92,7 @@ enum Status { private Status checkAnnotations(CLDRFile cldrFile) { Status status = Status.none; - for (String xpath : cldrFile) { + for (String xpath : cldrFile.iterableWithoutExtras()) { if (xpath.startsWith("//ldml/identity")) continue; boolean isAnnotation = xpath.startsWith("//ldml/annotation"); if (isAnnotation) { @@ -125,7 +125,7 @@ private Status checkAnnotations(CLDRFile cldrFile) { */ private String getUncontainedPath(CLDRFile subset, CLDRFile superset) { int debugCount = 0; - for (String xpath : subset) { + for (String xpath : subset.iterableWithoutExtras()) { if (++debugCount < 100) { logln(debugCount + "\t" + xpath); } @@ -148,8 +148,8 @@ private String getUncontainedPath(CLDRFile subset, CLDRFile superset) { private String differentPathValue(CLDRFile a, CLDRFile b) { int debugCount = 0; Set paths = new TreeSet<>(); - a.forEach(paths::add); - b.forEach(paths::add); + a.iterableDefault().forEach(paths::add); + b.iterableDefault().forEach(paths::add); for (String xpath : paths) { if (++debugCount < 100) { logln(debugCount + "\t" + xpath); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCldrResolver.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCldrResolver.java index ae153efb7cd..09a0054c319 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCldrResolver.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCldrResolver.java @@ -77,7 +77,7 @@ protected Map loadToolDataFromResolver(String locale) { // Resolve with the tool CLDRFile file = resolver.resolveLocale(locale); Map values = new HashMap(); - for (String path : file) { + for (String path : file.iterableDefault()) { values.put(path, file.getStringValue(path)); } return values; diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCollators.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCollators.java index 05386104dd3..f8cc1049749 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCollators.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCollators.java @@ -88,7 +88,7 @@ public static Set getAvailableTypes(String locale) { CLDRFile cldrFile = cldrFactory.make(locale, false); // don't need resolved Set results = new LinkedHashSet<>(); Matcher m = TYPE.matcher(""); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (m.reset(path).matches()) { String type = m.group(1); boolean newOne = results.add(type); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCoverageLevel.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCoverageLevel.java index e3b3620d405..c635339a383 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCoverageLevel.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCoverageLevel.java @@ -1073,7 +1073,7 @@ public void testLSR() { // Get root LSR codes - for (String path : root) { + for (String path : root.iterableDefault()) { if (!path.startsWith("//ldml/localeDisplayNames/")) { continue; } @@ -1269,7 +1269,7 @@ public void TestEnglishCoverage() { Output pathWhereFound = new Output<>(); Output localeWhereFound = new Output<>(); Set> inherited = new TreeSet<>(); - for (String path : ENGLISH) { + for (String path : ENGLISH.iterableDefault()) { String value = ENGLISH.getStringValueWithBailey(path, pathWhereFound, localeWhereFound); final boolean samePath = path.equals(pathWhereFound.value); final boolean sameLocale = "en".equals(localeWhereFound.value); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDTDAttributes.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDTDAttributes.java index 588be4eea1b..26c0df06be4 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDTDAttributes.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDTDAttributes.java @@ -561,7 +561,7 @@ static class NodeData { for (String locale : testInfo.getCldrFactory().getAvailable()) { CLDRFile file = testInfo.getCLDRFile(locale, false); NodeData nodeData = null; - for (String xpath : file) { + for (String xpath : file.iterableDefault()) { String value = file.getStringValue(xpath); String fullXpath = file.getFullXPath(xpath); XPathParts parts = XPathParts.getFrozenInstance(fullXpath); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDateOrder.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDateOrder.java index 5101a8ae0cd..ca76386955d 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDateOrder.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDateOrder.java @@ -116,7 +116,7 @@ public void TestIso8601() { Factory phf = PathHeader.getFactory(); Set paths = new TreeSet<>(); - for (String path : english) { + for (String path : english.iterableDefault()) { if (!path.startsWith("//ldml/dates/calendars/calendar[@type=\"gregorian\"]")) { continue; } else if (path.startsWith(stockTimePathPrefix) diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDayPeriods.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDayPeriods.java index 39c52099cc6..247bf53baea 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDayPeriods.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDayPeriods.java @@ -80,7 +80,7 @@ public void TestAttributes() { List periods = periodInfo.getPeriods(); CLDRFile cldrFile = CONFIG.getCLDRFile(locale, false); for (Iterator it = - cldrFile.iterator( + cldrFile.iteratorWithoutExtras( "//ldml/dates/calendars/calendar[@type=\"gregorian\"]/dayPeriods/"); it.hasNext(); ) { String path = it.next(); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDisplayAndInputProcessor.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDisplayAndInputProcessor.java index da9d80d3634..97b6a07751a 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDisplayAndInputProcessor.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDisplayAndInputProcessor.java @@ -342,7 +342,7 @@ public void TestAdlamNasalization() { private void showCldrFile(final CLDRFile cldrFile) { DisplayAndInputProcessor daip = new DisplayAndInputProcessor(cldrFile, true); Exception[] internalException = new Exception[1]; - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { String value = cldrFile.getStringValue(path); if (value == null) { continue; // values may be null, from extraPaths diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestExampleGenerator.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestExampleGenerator.java index 42e48b85783..55b4c4d9e68 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestExampleGenerator.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestExampleGenerator.java @@ -925,7 +925,7 @@ public void Test4897() { final CLDRFile cldrFile = exampleGenerator.getCldrFile(); for (String xpath : With.in( - cldrFile.iterator( + cldrFile.iteratorWithoutExtras( "//ldml/dates/timeZoneNames", cldrFile.getComparator()))) { String value = cldrFile.getStringValue(xpath); String actual = exampleGenerator.getExampleHtml(xpath, value); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestInheritance.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestInheritance.java index 5a887bf1c66..2bdbe25d1af 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestInheritance.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestInheritance.java @@ -860,7 +860,7 @@ public void TestCldrFileConsistency() { for (String locale : testInfo.getCldrFactory().getAvailable()) { CLDRFile cldrFileToCheck = testInfo.getCLDRFile(locale, false); int errors = 0; - for (String path : cldrFileToCheck) { + for (String path : cldrFileToCheck.iterableDefault()) { if (!pathMatcher.reset(path).find()) { continue; } diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestLocale.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestLocale.java index ee209c18620..13dbb344c4e 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestLocale.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestLocale.java @@ -235,7 +235,7 @@ public void TestLocalePartsValidity() { } // now check English-resolved CLDRFile english = testInfo.getEnglish(); - for (String xpath : english) { + for (String xpath : english.iterableDefault()) { if (!xpath.startsWith("//ldml/localeDisplayNames/")) { continue; } diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestOutdatedPaths.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestOutdatedPaths.java index fa79be30954..1c8ff4166d5 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestOutdatedPaths.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestOutdatedPaths.java @@ -24,7 +24,7 @@ public static void main(String[] args) { public void TestBirths() { Multimap birthToPaths = TreeMultimap.create(); - for (String path : testInfo.getEnglish()) { + for (String path : testInfo.getEnglish().iterableDefault()) { CldrVersion birth = outdatedPaths.getEnglishBirth(path); if (birth == null) birth = CldrVersion.unknown; birthToPaths.put(birth, path); @@ -67,7 +67,7 @@ private void checkShow(PathHeader.Factory pathHeaders, String locale) { Map sorted = new TreeMap(); logln(locale + " total outdated:\t" + outdatedPaths.countOutdated(locale)); - for (String spath : cldrFile) { + for (String spath : cldrFile.iterableDefault()) { if (outdatedPaths.isOutdated(locale, spath)) { sorted.put(pathHeaders.fromPath(spath), ""); } diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathHeader.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathHeader.java index 0cc9ae55b70..7599eacea4d 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathHeader.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathHeader.java @@ -887,7 +887,7 @@ public void check( Set alreadySeen) { CLDRFile nativeFile = info.getCLDRFile(localeID, resolved); int count = 0; - for (String path : nativeFile) { + for (String path : nativeFile.iterableDefault()) { if (alreadySeen.contains(path)) { continue; } @@ -1003,7 +1003,7 @@ public void TestZ() { Map collide = new TreeMap<>(); logln("Traversing Paths"); - for (String path : english) { + for (String path : english.iterableDefault()) { PathHeader pathHeader = pathHeaderFactory.fromPath(path); String value = english.getStringValue(path); if (pathHeader == null) { @@ -1416,7 +1416,8 @@ public void TestSupplementalItems() { CLDRConfig.getInstance().getSupplementalFactory().make("supplementalData", false); List failures = new ArrayList<>(); Multimap pathValuePairs = LinkedListMultimap.create(); - for (String test : With.in(supplementalFile.iterator("//supplementalData/weekData"))) { + for (String test : + With.in(supplementalFile.iteratorWithoutExtras("//supplementalData/weekData"))) { failures.clear(); XPathParts parts = XPathParts.getFrozenInstance(supplementalFile.getFullXPath(test)); supplementalFile.getDtdData().getRegularizedPaths(parts, pathValuePairs); @@ -1475,7 +1476,7 @@ public void testPathHeaderSize() { PathHeader.Factory phf = PathHeader.getFactory(CLDRConfig.getInstance().getEnglish()); Counter counterPageId = new Counter<>(); Counter counterPageIdAll = new Counter<>(); - for (String path : english) { + for (String path : english.iterableDefault()) { Level level = CLDRConfig.getInstance() .getSupplementalDataInfo() @@ -1704,7 +1705,7 @@ public void testPageSize() { PathHeader.Factory phf = PathHeader.getFactory(); Counter c = new Counter<>(); counters.add(c); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { PathHeader ph = phf.fromPath(path); c.add(ph.getPageId(), 1); } diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathLookup.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathLookup.java index 2fd4d682b1d..3c9333b02f8 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathLookup.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathLookup.java @@ -95,7 +95,7 @@ public void testDowngrade() { public int countMatches(CLDRFile cldrFile) { String locale = cldrFile.getLocaleID(); int count = 0; - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { String value = cldrFile.getStringValue(path); if (DowngradePaths.lookingAt("en", path, value)) { logln(String.format("%s\t%s\t%s", locale, path, value)); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPaths.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPaths.java index a597557aeb4..db0ecaa9b3d 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPaths.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPaths.java @@ -53,9 +53,9 @@ public static void main(String[] args) { public void VerifyEnglishVsRoot() { HashSet rootPaths = new HashSet<>(); - testInfo.getRoot().forEach(rootPaths::add); + testInfo.getRoot().iterableDefault().forEach(rootPaths::add); HashSet englishPaths = new HashSet<>(); - testInfo.getEnglish().forEach(englishPaths::add); + testInfo.getEnglish().iterableDefault().forEach(englishPaths::add); englishPaths.removeAll(rootPaths); if (englishPaths.size() == 0) { return; @@ -136,7 +136,7 @@ public void TestPathHeadersAndValues() { logln("Testing path headers and values for locale => " + locale); final Collection extraPaths = file.getExtraPaths(); - for (Iterator it = file.iterator(); it.hasNext(); ) { + for (Iterator it = file.iteratorWithoutExtras(); it.hasNext(); ) { String path = it.next(); if (isExemptLocale && path.equals(exemptPathIfLocale)) { logKnownIssue("CLDR-17544", "Can't reproduce locally"); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPerf.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPerf.java index 3fe6c94fcbb..5ea2c4d97d4 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPerf.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPerf.java @@ -30,7 +30,7 @@ public static void main(String[] args) { static { Set testPaths_ = new HashSet(); - CLDRConfig.getInstance().getEnglish().forEach(testPaths_::add); + CLDRConfig.getInstance().getEnglish().iterableDefault().forEach(testPaths_::add); testPaths = Collections.unmodifiableSet(testPaths_); Set sorted = new TreeSet(CLDRFile.getComparator(DtdType.ldml)); sorted.addAll(testPaths); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPersonNameFormatter.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPersonNameFormatter.java index f8c6679f7ab..ac46cf35d2a 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPersonNameFormatter.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPersonNameFormatter.java @@ -489,7 +489,7 @@ public void TestExampleGenerator() { for (String localeId : Arrays.asList("en")) { final CLDRFile cldrFile = factory.make(localeId, true); ExampleGenerator exampleGenerator2 = new ExampleGenerator(cldrFile, ENGLISH); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (path.startsWith("//ldml/personNames") && !path.endsWith("/alias")) { XPathParts parts = XPathParts.getFrozenInstance(path); String value = ENGLISH.getStringValue(path); @@ -573,7 +573,7 @@ public void TestExampleDependencies() { // List all the paths that have dependencies, so we can verify they are ok PathStarrer ps = new PathStarrer().setSubstitutionPattern("*"); - for (String path : resolved) { + for (String path : resolved.iterableDefault()) { if (path.startsWith("//ldml/personNames") && !path.endsWith("/alias")) { logln(ps.set(path)); } @@ -1470,7 +1470,7 @@ public void testInitials() { public void showMissingGiven() { for (String locale : StandardCodes.make().getLocaleCoverageLocales(Organization.cldr)) { CLDRFile cldrFile = factory.make(locale, false); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (!path.startsWith("//ldml/personNames/personName")) { continue; } @@ -1509,7 +1509,7 @@ public void showLiteralsInMononyms() { CLDRFile cldrFile = factory.make(locale, false); StringBuilder b = new StringBuilder(); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (!path.startsWith("//ldml/personNames/personName")) { continue; } diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestStringByteConverter.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestStringByteConverter.java index 0b387523b31..266298ba7a9 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestStringByteConverter.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestStringByteConverter.java @@ -100,7 +100,7 @@ private static void testWithLocale(String locale, Type type) throws IOException totalUtf8Bytes = totalBytes = 0; Factory cldrFactory = Factory.make(org.unicode.cldr.util.CLDRPaths.MAIN_DIRECTORY, ".*"); CLDRFile file = cldrFactory.make(locale, false); - for (String path : file) { + for (String path : file.iterableDefault()) { if (path.contains("exemplarCh")) { continue; } diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestTransforms.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestTransforms.java index bdad4277e1c..db00b05f1ff 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestTransforms.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestTransforms.java @@ -211,7 +211,7 @@ public void TestUzbek() { Set latinFromCyrillicSucceeds = new TreeSet<>(); Set latinFromCyrillicFails = new TreeSet<>(); - for (String path : uzCyrl) { + for (String path : uzCyrl.iterableDefault()) { String latnValue = uzLatn.getStringValue(path); if (latnValue == null) { continue; @@ -885,7 +885,7 @@ public void TestLocales() { } badPlusSample.clear(); CLDRFile file = factory.make(locale, false); - for (String path : file) { + for (String path : file.iterableWithoutExtras()) { if (path.contains("/exemplar") || path.contains("/parseLenients")) { continue; } diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestUnits.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestUnits.java index 7d7a08ad6a4..5eadec05d6c 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestUnits.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestUnits.java @@ -189,7 +189,7 @@ public static void main(String[] args) { public void TestSpaceInNarrowUnits() { final CLDRFile english = CLDR_CONFIG.getEnglish(); final Matcher m = Pattern.compile("narrow.*unitPattern").matcher(""); - for (String path : english) { + for (String path : english.iterableDefault()) { if (m.reset(path).find()) { String value = english.getStringValue(path); if (value.contains("} ")) { @@ -2460,7 +2460,7 @@ public Set minus(Collection a, V... b) { } public Set getUnits(CLDRFile root, Set unitLongIds) { - for (String path : root) { + for (String path : root.iterableDefault()) { XPathParts parts = XPathParts.getFrozenInstance(path); int item = parts.findElement("unit"); if (item == -1) { @@ -2831,7 +2831,7 @@ public void TestCheckUnits() { checkUnits.setCldrFileToCheck(cldrFile, options, possibleErrors); for (String path : - StreamSupport.stream(cldrFile.spliterator(), false) + StreamSupport.stream(cldrFile.iterableDefault().spliterator(), false) .sorted() .collect(Collectors.toList())) { UnitPathType pathType = @@ -3018,7 +3018,7 @@ public void TestGenderOfCompounds() { new TreeMap(), Boolean.class); - for (String path : cldrFile) { + for (String path : cldrFile.iterableWithoutExtras()) { if (!path.startsWith("//ldml/units/unitLength[@type=\"long\"]/unit[@type=")) { continue; } @@ -3242,7 +3242,7 @@ public void TestUnitOrder() { */ public Set checkCldrFileUnits(String title, final CLDRFile cldrFile) { Set shortUnitsFound = new TreeSet<>(); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (!path.startsWith("//ldml/units/unitLength")) { continue; } @@ -3294,7 +3294,7 @@ public void TestElectricConsumption() { public void TestEnglishDisplayNames() { CLDRFile en = CLDRConfig.getInstance().getEnglish(); ImmutableSet unitSkips = ImmutableSet.of("temperature-generic", "graphics-em"); - for (String path : en) { + for (String path : en.iterableDefault()) { if (path.startsWith("//ldml/units/unitLength[@type=\"long\"]") && path.endsWith("/displayName")) { if (path.contains("coordinateUnit")) { @@ -3371,7 +3371,8 @@ public void TestUnitsToTranslate() { for (String path : With.in( config.getRoot() - .iterator("//ldml/units/unitLength[@type=\"short\"]/unit"))) { + .iteratorWithoutExtras( + "//ldml/units/unitLength[@type=\"short\"]/unit"))) { XPathParts parts = XPathParts.getFrozenInstance(path); String longUnit = parts.getAttributeValue(3, "type"); // Add simple units diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/UnicodeSetPrettyPrinterTest.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/UnicodeSetPrettyPrinterTest.java index fa238afc7af..1dd6d74cd36 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/UnicodeSetPrettyPrinterTest.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/UnicodeSetPrettyPrinterTest.java @@ -251,7 +251,7 @@ public void testSimpleUnicodeSetFormatterWithLocales() { localeNeedsEscape.addAll(source); } CLDRFile cldrFile2 = cldrFactory.make(locale, false); // just existing paths - for (String path : cldrFile2) { + for (String path : cldrFile2.iterableDefault()) { String value = cldrFile2.getStringValue(path); if (value.equals("↑↑↑")) { continue; diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/util/TestCLDRFile.java b/tools/cldr-code/src/test/java/org/unicode/cldr/util/TestCLDRFile.java index 07519f00322..2f87225f1cd 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/util/TestCLDRFile.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/util/TestCLDRFile.java @@ -151,7 +151,7 @@ private void TestReadAllDTDs(final String subdir, Factory factory, final String /*final String value = */ file.getStringValue(xpath); } - for (Iterator i = file.iterator(); i.hasNext(); ) { + for (Iterator i = file.iteratorWithoutExtras(); i.hasNext(); ) { final String xpath = i.next(); assertNotNull(xpath, subdir + ":" + id + " xpath"); /*final String value = */ file.getStringValue(xpath); @@ -159,7 +159,7 @@ private void TestReadAllDTDs(final String subdir, Factory factory, final String // This is to simulate what is in the LDML2JsonConverter final Comparator comparator = DtdData.getInstance(file.getDtdType()).getDtdComparator(null); - for (Iterator it = file.iterator("", comparator); it.hasNext(); ) { + for (Iterator it = file.iteratorWithoutExtras("", comparator); it.hasNext(); ) { final String xpath = it.next(); assertNotNull(xpath, subdir + ":" + id + " xpath"); } diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/util/TestPUAs.java b/tools/cldr-code/src/test/java/org/unicode/cldr/util/TestPUAs.java index cbfa7dff56e..b1a050ab5a9 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/util/TestPUAs.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/util/TestPUAs.java @@ -34,7 +34,7 @@ public static Stream collatorProvider() { CLDRFile cldrFile = INSTANCE.collatorFactory.make(locale, false); // don't need resolved Matcher m = INSTANCE.COLLATOR_TYPE.matcher(""); Set results = new LinkedHashSet<>(); - for (String path : cldrFile) { + for (String path : cldrFile.iterableDefault()) { if (m.reset(path).matches()) { String type = m.group(1); boolean newOne = results.add(type); diff --git a/tools/cldr-rdf/src/main/java/org/unicode/cldr/tool/WikiSubdivisionLanguages.java b/tools/cldr-rdf/src/main/java/org/unicode/cldr/tool/WikiSubdivisionLanguages.java index 65bae7731ec..45242b9fdf7 100644 --- a/tools/cldr-rdf/src/main/java/org/unicode/cldr/tool/WikiSubdivisionLanguages.java +++ b/tools/cldr-rdf/src/main/java/org/unicode/cldr/tool/WikiSubdivisionLanguages.java @@ -387,7 +387,7 @@ private static CLDRFile fixedFile( Set toRemove = new HashSet<>(); Map toAdd = new HashMap<>(); - for (String path : fileSubdivisions) { + for (String path : fileSubdivisions.iterableDefault()) { XPathParts parts = XPathParts.getFrozenInstance(path); if (!"subdivision".equals(parts.getElement(-1))) { continue;