Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code quality fix - Synchronized classes Vector, Hashtable, Stack and StringBuffer should not be used. #282

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/org/anddev/andengine/util/pool/GenericPool.java
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -24,7 +24,7 @@ public abstract class GenericPool<T> {
// Fields
// ===========================================================

private final Stack<T> mAvailableItems = new Stack<T>();
private final Deque<T> mAvailableItems = new LinkedList<T>();
private int mUnrecycledCount;
private final int mGrowth;

Expand Down Expand Up @@ -89,7 +89,7 @@ protected void onHandleObtainItem(final T pItem) {
}

public synchronized void batchAllocatePoolItems(final int pCount) {
final Stack<T> availableItems = this.mAvailableItems;
final Deque<T> availableItems = this.mAvailableItems;
for(int i = pCount - 1; i >= 0; i--) {
availableItems.push(this.onHandleAllocatePoolItem());
}
Expand Down Expand Up @@ -132,7 +132,7 @@ public synchronized void recyclePoolItem(final T pItem) {
}

public synchronized void shufflePoolItems() {
Collections.shuffle(this.mAvailableItems);
Collections.shuffle((List<T>)this.mAvailableItems);
}

// ===========================================================
Expand Down