From ff0157486440f74c28f96e3708ed9e958086d65b Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Mon, 20 Jan 2014 05:39:52 +0100 Subject: [configuration] Copy less lists during resolving --- .../BubblingConfigurationResolver.java | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/core/lombok/core/configuration/BubblingConfigurationResolver.java b/src/core/lombok/core/configuration/BubblingConfigurationResolver.java index 3bcc331c..623c6cc0 100644 --- a/src/core/lombok/core/configuration/BubblingConfigurationResolver.java +++ b/src/core/lombok/core/configuration/BubblingConfigurationResolver.java @@ -40,16 +40,15 @@ public class BubblingConfigurationResolver implements ConfigurationResolver { @Override public T resolve(ConfigurationKey key) { boolean isList = key.getType().isList(); - List listModifications = null; + List> listModificationsList = null; for (ConfigurationSource source : sources) { Result result = source.resolve(key); if (result == null) continue; if (isList) { - if (listModifications == null) { - listModifications = new ArrayList((List)result.getValue()); - } else { - listModifications.addAll(0, (List)result.getValue()); + if (listModificationsList == null) { + listModificationsList = new ArrayList>(); } + listModificationsList.add((List)result.getValue()); } if (result.isAuthoritative()) { if (isList) { @@ -61,14 +60,17 @@ public class BubblingConfigurationResolver implements ConfigurationResolver { if (!isList) { return null; } - if (listModifications == null) { + if (listModificationsList == null) { return (T) Collections.emptyList(); } List listValues = new ArrayList(); - for (ListModification modification : listModifications) { - listValues.remove(modification.getValue()); - if (modification.isAdded()) { - listValues.add(modification.getValue()); + Collections.reverse(listModificationsList); + for (List listModifications : listModificationsList) { + for (ListModification modification : listModifications) { + listValues.remove(modification.getValue()); + if (modification.isAdded()) { + listValues.add(modification.getValue()); + } } } return (T) listValues; -- cgit