diff options
author | Sven Gothel <[email protected]> | 2013-10-17 16:18:53 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-10-17 16:18:53 +0200 |
commit | 5b77e15500b7b19d35976603dd71e8b997b2d8ea (patch) | |
tree | 205628033702d0b9b632e86fe70a7141a689c2b5 /src | |
parent | 37a512b572091dd91bb4edaa4b096a43604bb44d (diff) |
ArrayHashSet: Use final local vars if applicable
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/jogamp/common/util/ArrayHashSet.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/java/com/jogamp/common/util/ArrayHashSet.java b/src/java/com/jogamp/common/util/ArrayHashSet.java index 3289924..ed3590a 100644 --- a/src/java/com/jogamp/common/util/ArrayHashSet.java +++ b/src/java/com/jogamp/common/util/ArrayHashSet.java @@ -95,9 +95,9 @@ public class ArrayHashSet<E> */ @Override public final Object clone() { - ArrayList<E> clonedList = new ArrayList<E>(data); + final ArrayList<E> clonedList = new ArrayList<E>(data); - ArrayHashSet<E> newObj = new ArrayHashSet<E>(); + final ArrayHashSet<E> newObj = new ArrayHashSet<E>(); newObj.addAll(clonedList); return newObj; @@ -131,7 +131,7 @@ public class ArrayHashSet<E> */ @Override public final boolean add(E element) { - boolean exists = map.containsKey(element); + final boolean exists = map.containsKey(element); if(!exists) { if(null != map.put(element, element)) { throw new InternalError("Already existing, but checked before: "+element); @@ -343,7 +343,7 @@ public class ArrayHashSet<E> */ @Override public final E set(int index, E element) { - E old = remove(index); + final E old = remove(index); if(null!=old) { add(index, element); } @@ -359,7 +359,7 @@ public class ArrayHashSet<E> */ @Override public final E remove(int index) { - E o = get(index); + final E o = get(index); if( null!=o && remove(o) ) { return o; } @@ -428,13 +428,13 @@ public class ArrayHashSet<E> * or add the given <code>key</code> and return it. */ public final E getOrAdd(E key) { - E identity = get(key); + final E identity = get(key); if(null == identity) { // object not contained yet, add it if(!this.add(key)) { throw new InternalError("Key not mapped, but contained in list: "+key); } - identity = key; + return key; } return identity; } |