From 20fa3db24170aeefbe6ea7134767ca7516bd5b8d Mon Sep 17 00:00:00 2001 From: Brian Reynolds Date: Wed, 29 Mar 2023 15:01:19 -0400 Subject: [PATCH] more efficient? --- .../module/properties/ChangePropertyButton.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/vassal-app/src/main/java/VASSAL/build/module/properties/ChangePropertyButton.java b/vassal-app/src/main/java/VASSAL/build/module/properties/ChangePropertyButton.java index 63900d33b2..4bc22960e0 100644 --- a/vassal-app/src/main/java/VASSAL/build/module/properties/ChangePropertyButton.java +++ b/vassal-app/src/main/java/VASSAL/build/module/properties/ChangePropertyButton.java @@ -37,7 +37,9 @@ import java.awt.Component; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.stream.Stream; /** * Adds a toolbar button that changes the value of a global property @@ -112,13 +114,12 @@ public PropertyChanger getPropertyChanger() { @Override public String[] getAttributeDescriptions() { - String[] descs = { Resources.getString("Editor.description_label") }; - for (final String s : super.getAttributeDescriptions()) { - descs = ArrayUtils.add(descs, s); - } - descs = ArrayUtils.add(descs, Resources.getString("Editor.report_format")); - descs = ArrayUtils.add(descs, Resources.getString("Editor.ChangePropertyButton.options")); - return descs; + final Stream.Builder b = Stream.builder().add(Resources.getString("Editor.description_label")); + Arrays.stream(super.getAttributeDescriptions()).forEach(b::add); + b.add(Resources.getString("Editor.report_format")) + .add(Resources.getString("Editor.ChangePropertyButton.options")); + + return b.build().toArray(String[]::new); } @Override