diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2015-01-26 13:52:50 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2015-01-26 13:52:50 +0100 |
commit | 30beb498ca46772e60dd321a07e19be1d08d1e9a (patch) | |
tree | 7fe984d4c745408b1dd2cfc9f51d3205a258bbf1 /test/transform/resource/after-ecj/BuilderSingularNoAutosingularize.java | |
parent | 75da1e2481d077d6c39b91aa9d364a397a41461f (diff) | |
download | lombok-30beb498ca46772e60dd321a07e19be1d08d1e9a.tar.gz lombok-30beb498ca46772e60dd321a07e19be1d08d1e9a.tar.bz2 lombok-30beb498ca46772e60dd321a07e19be1d08d1e9a.zip |
optimized the creation for singular lists/collections.
Diffstat (limited to 'test/transform/resource/after-ecj/BuilderSingularNoAutosingularize.java')
-rw-r--r-- | test/transform/resource/after-ecj/BuilderSingularNoAutosingularize.java | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/test/transform/resource/after-ecj/BuilderSingularNoAutosingularize.java b/test/transform/resource/after-ecj/BuilderSingularNoAutosingularize.java index 53bed757..16febc2e 100644 --- a/test/transform/resource/after-ecj/BuilderSingularNoAutosingularize.java +++ b/test/transform/resource/after-ecj/BuilderSingularNoAutosingularize.java @@ -54,9 +54,7 @@ import lombok.Singular; things = java.util.Collections.singletonList(this.things.get(0)); break; default : - things = new java.util.ArrayList<String>(this.things.size()); - things.addAll(this.things); - things = java.util.Collections.unmodifiableList(things); + things = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.things)); } java.util.List<String> widgets; switch (((this.widgets == null) ? 0 : this.widgets.size())) { @@ -67,9 +65,7 @@ import lombok.Singular; widgets = java.util.Collections.singletonList(this.widgets.get(0)); break; default : - widgets = new java.util.ArrayList<String>(this.widgets.size()); - widgets.addAll(this.widgets); - widgets = java.util.Collections.unmodifiableList(widgets); + widgets = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.widgets)); } java.util.List<String> items; switch (((this.items == null) ? 0 : this.items.size())) { @@ -80,9 +76,7 @@ import lombok.Singular; items = java.util.Collections.singletonList(this.items.get(0)); break; default : - items = new java.util.ArrayList<String>(this.items.size()); - items.addAll(this.items); - items = java.util.Collections.unmodifiableList(items); + items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.items)); } return new BuilderSingularNoAutosingularize(things, widgets, items); } |