You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2019/09/04 18:59:47 UTC

[GitHub] [accumulo] ctubbsii commented on a change in pull request #1333: Removed LinkedList from CachedBlockQueue in favor of ArrayList

ctubbsii commented on a change in pull request #1333: Removed LinkedList from CachedBlockQueue in favor of ArrayList
URL: https://github.com/apache/accumulo/pull/1333#discussion_r320923013
 
 

 ##########
 File path: core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/CachedBlockQueue.java
 ##########
 @@ -91,24 +93,19 @@ public void add(CachedBlock cb) {
    * @return list of cached elements in descending order
    */
   public CachedBlock[] get() {
-    LinkedList<CachedBlock> blocks = new LinkedList<>();
-    while (!queue.isEmpty()) {
-      blocks.addFirst(queue.poll());
-    }
-    return blocks.toArray(new CachedBlock[blocks.size()]);
+     CachedBlock[] blocks = queue.toArray(new CachedBlock[0]);
 
 Review comment:
   @belugabehr responded to my similar comment above in https://github.com/apache/accumulo/pull/1333#discussion_r317404335

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services