From 83ac99da747d7e94d06a5ae473097741bb3d131e Mon Sep 17 00:00:00 2001 From: yueh Date: Sat, 22 Oct 2016 12:32:53 +0200 Subject: [PATCH] Fixes #2496: Removed potentially superfluous list copy. --- src/main/java/appeng/me/NetworkList.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/main/java/appeng/me/NetworkList.java b/src/main/java/appeng/me/NetworkList.java index 166bf240..f71fe97f 100644 --- a/src/main/java/appeng/me/NetworkList.java +++ b/src/main/java/appeng/me/NetworkList.java @@ -25,6 +25,9 @@ import java.util.LinkedList; import java.util.List; +/** + * TODO: Test if copy was actually necessary. + */ public class NetworkList implements Collection { @@ -69,14 +72,12 @@ public class NetworkList implements Collection @Override public boolean add( final Grid e ) { - this.copy(); return this.networks.add( e ); } @Override public boolean remove( final Object o ) { - this.copy(); return this.networks.remove( o ); } @@ -89,21 +90,18 @@ public class NetworkList implements Collection @Override public boolean addAll( final Collection c ) { - this.copy(); return this.networks.addAll( c ); } @Override public boolean removeAll( final Collection c ) { - this.copy(); return this.networks.removeAll( c ); } @Override public boolean retainAll( final Collection c ) { - this.copy(); return this.networks.retainAll( c ); } @@ -112,11 +110,4 @@ public class NetworkList implements Collection { this.networks = new LinkedList(); } - - private void copy() - { - final List old = this.networks; - this.networks = new LinkedList(); - this.networks.addAll( old ); - } }