From c9e48aa10a8824bb10bd50e5bd510a05275d9ef3 Mon Sep 17 00:00:00 2001 From: Faisal Hameed Date: Wed, 18 May 2016 15:29:07 +0500 Subject: [PATCH] Fixing squid:S1149 - Synchronized classes Vector, Hashtable, Stack and StringBuffer should not be used. --- src/org/anddev/andengine/util/pool/GenericPool.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/org/anddev/andengine/util/pool/GenericPool.java b/src/org/anddev/andengine/util/pool/GenericPool.java index a6da3ccfc..5bc8200a5 100644 --- a/src/org/anddev/andengine/util/pool/GenericPool.java +++ b/src/org/anddev/andengine/util/pool/GenericPool.java @@ -1,7 +1,7 @@ package org.anddev.andengine.util.pool; import java.util.Collections; -import java.util.Stack; +import java.util.Deque; import org.anddev.andengine.util.Debug; @@ -24,7 +24,7 @@ public abstract class GenericPool { // Fields // =========================================================== - private final Stack mAvailableItems = new Stack(); + private final Deque mAvailableItems = new LinkedList(); private int mUnrecycledCount; private final int mGrowth; @@ -89,7 +89,7 @@ protected void onHandleObtainItem(final T pItem) { } public synchronized void batchAllocatePoolItems(final int pCount) { - final Stack availableItems = this.mAvailableItems; + final Deque availableItems = this.mAvailableItems; for(int i = pCount - 1; i >= 0; i--) { availableItems.push(this.onHandleAllocatePoolItem()); } @@ -132,7 +132,7 @@ public synchronized void recyclePoolItem(final T pItem) { } public synchronized void shufflePoolItems() { - Collections.shuffle(this.mAvailableItems); + Collections.shuffle((List)this.mAvailableItems); } // ===========================================================