diff --git a/src/main/java/com/android/volley/RequestQueue.java b/src/main/java/com/android/volley/RequestQueue.java index 6e084e52..0f2e7566 100644 --- a/src/main/java/com/android/volley/RequestQueue.java +++ b/src/main/java/com/android/volley/RequestQueue.java @@ -59,7 +59,7 @@ public interface RequestFinishedListener { * */ private final Map>> mWaitingRequests = - new HashMap>>(); + new HashMap<>(); /** * The set of all requests currently being processed by this RequestQueue. A Request @@ -70,11 +70,11 @@ public interface RequestFinishedListener { /** The cache triage queue. */ private final PriorityBlockingQueue> mCacheQueue = - new PriorityBlockingQueue>(); + new PriorityBlockingQueue<>(); /** The queue of requests that are actually going out to the network. */ private final PriorityBlockingQueue> mNetworkQueue = - new PriorityBlockingQueue>(); + new PriorityBlockingQueue<>(); /** Number of network request dispatcher threads to start. */ private static final int DEFAULT_NETWORK_THREAD_POOL_SIZE = 4; @@ -95,7 +95,7 @@ public interface RequestFinishedListener { private CacheDispatcher mCacheDispatcher; private final List mFinishedListeners = - new ArrayList(); + new ArrayList<>(); /** * Creates the worker pool. Processing will not begin until {@link #start()} is called. @@ -160,9 +160,9 @@ public void stop() { if (mCacheDispatcher != null) { mCacheDispatcher.quit(); } - for (int i = 0; i < mDispatchers.length; i++) { - if (mDispatchers[i] != null) { - mDispatchers[i].quit(); + for (final NetworkDispatcher mDispatcher : mDispatchers) { + if (mDispatcher != null) { + mDispatcher.quit(); } } } @@ -248,7 +248,7 @@ public Request add(Request request) { // There is already a request in flight. Queue up. Queue> stagedRequests = mWaitingRequests.get(cacheKey); if (stagedRequests == null) { - stagedRequests = new LinkedList>(); + stagedRequests = new LinkedList<>(); } stagedRequests.add(request); mWaitingRequests.put(cacheKey, stagedRequests); diff --git a/src/main/java/com/android/volley/toolbox/BasicNetwork.java b/src/main/java/com/android/volley/toolbox/BasicNetwork.java index 3f9e695f..8997f8bc 100644 --- a/src/main/java/com/android/volley/toolbox/BasicNetwork.java +++ b/src/main/java/com/android/volley/toolbox/BasicNetwork.java @@ -257,7 +257,7 @@ private byte[] entityToBytes(HttpEntity entity) throws IOException, ServerError } catch (IOException e) { // This can happen if there was an exception above that left the entity in // an invalid state. - VolleyLog.v("Error occured when calling consumingContent"); + VolleyLog.v("Error occurred when calling consumingContent"); } mPool.returnBuf(buffer); bytes.close();