Skip to content

Commit c6a737b

Browse files
committed
After Markus’s review
1 parent d889ae5 commit c6a737b

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

UnicodeJsps/src/main/java/org/unicode/jsp/UnicodeUtilities.java

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import java.util.TreeSet;
4242
import java.util.regex.Matcher;
4343
import java.util.regex.Pattern;
44+
import java.util.stream.Collectors;
4445
import org.unicode.cldr.tool.TablePrinter;
4546
import org.unicode.cldr.util.Predicate;
4647
import org.unicode.cldr.util.UnicodeSetPrettyPrinter;
@@ -1685,9 +1686,7 @@ class PropertyAssignment {
16851686
continue;
16861687
}
16871688
ArrayList<String> values = new ArrayList<>();
1688-
for (String value : property.getValues(codePoint)) {
1689-
values.add(value);
1690-
}
1689+
property.getValues(codePoint).forEach(values::add);
16911690
PropertyAssignment lastAssignment =
16921691
history.isEmpty() ? null : history.get(history.size() - 1);
16931692
if (lastAssignment == null || (!values.equals(lastAssignment.values))) {
@@ -1706,9 +1705,7 @@ class PropertyAssignment {
17061705
current.first = Settings.LAST_VERSION_INFO;
17071706
current.last = Settings.LAST_VERSION_INFO;
17081707
current.values = new ArrayList<>();
1709-
for (String value : getFactory().getProperty(propName).getValues(codePoint)) {
1710-
current.values.add(value);
1711-
}
1708+
getFactory().getProperty(propName).getValues(codePoint).forEach(current.values::add);
17121709
history.add(current);
17131710
}
17141711
out.append(
@@ -1738,34 +1735,26 @@ class PropertyAssignment {
17381735
boolean isNew = assignment.first == Settings.LATEST_VERSION_INFO;
17391736
String versionRange =
17401737
(showVersion ? (isSingleVersion ? first : first + ".." + last) + ": " : "");
1741-
var htmlValue = new StringBuilder();
1742-
for (int i = 0; i < assignment.values.size(); ++i) {
1743-
if (i > 0) {
1744-
htmlValue.append("<wbr>|");
1745-
}
1746-
String value = assignment.values.get(i);
1747-
if (value == null) {
1748-
htmlValue.append("<i>null</i>");
1749-
} else {
1750-
htmlValue.append(toHTML.transliterate(value));
1751-
}
1752-
}
1738+
String htmlValue =
1739+
assignment.values.stream()
1740+
.map(v -> v == null ? "<i>null</i>" : toHTML.transliterate(v))
1741+
.collect(Collectors.joining("<wbr>|"));
17531742
out.append(
17541743
"<td"
17551744
+ defaultClass
17561745
+ ">"
1757-
+ (isMultivalued
1746+
+ (isMultivalued || htmlValue.contains("<")
17581747
? "<span" + (isNew ? " class='changed'" : "") + ">"
17591748
: ("<a target='u' "
17601749
+ (isNew ? "class='changed' " : "")
17611750
+ "href='list-unicodeset.jsp?a=[:"
17621751
+ (isCurrent ? "" : "U" + last + ":")
17631752
+ propName
17641753
+ "="
1765-
+ htmlValue.toString()
1754+
+ htmlValue
17661755
+ ":]'>"))
17671756
+ versionRange
1768-
+ htmlValue.toString()
1757+
+ htmlValue
17691758
+ (isMultivalued ? "</span>" : "</a>")
17701759
+ "</td>");
17711760
}

0 commit comments

Comments
 (0)