refactor: Replace computeIfAbsent with manual check for Java 1.7 compatibility

This commit is contained in:
Arnaud Roques 2024-04-06 13:28:57 +02:00
parent 06d06e729b
commit 460d53f12b
2 changed files with 4 additions and 5 deletions

View File

@ -86,9 +86,8 @@ public class CommandStyleImport extends SingleLineCommand2<TitledDiagram> {
if (path.startsWith("http://") || path.startsWith("https://")) {
SURL url = SURL.create(path);
try (InputStream remoteInputStream = url.openStream()) {
if (remoteInputStream != null) {
if (remoteInputStream != null)
lines = BlocLines.load(remoteInputStream, location);
}
}
} else {
final SFile styleFile = FileSystem.getInstance().getFile(path);

View File

@ -54,7 +54,6 @@ import net.sourceforge.plantuml.utils.Log;
public class XmiClassDiagramScript extends XmiClassDiagramAbstract implements XmlDiagramTransformer {
private static class MemberData {
public final String name;
public final String id;
@ -103,7 +102,9 @@ public class XmiClassDiagramScript extends XmiClassDiagramAbstract implements Xm
continue;
element.appendChild(cla);
members.computeIfAbsent(ent.getUid(), (e) -> new ArrayList<>());
if (members.containsKey(ent.getUid()) == false)
members.put(ent.getUid(), new ArrayList<MemberData>());
NodeList attrs = cla.getElementsByTagName("UML:Attribute");
for (int i = 0; i < attrs.getLength(); i++) {
Element child = (Element) attrs.item(i);
@ -288,5 +289,4 @@ public class XmiClassDiagramScript extends XmiClassDiagramAbstract implements Xm
}
}