You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/04/13 18:40:50 UTC

[GitHub] [commons-jcs] arturobernalg opened a new pull request #62: JCS-220 - Java8 improvement

arturobernalg opened a new pull request #62:
URL: https://github.com/apache/commons-jcs/pull/62


   - Use  Comparator.comparingLong
   - Use method reference
   - Use lambda 


-- 
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



[GitHub] [commons-jcs] tvand commented on a change in pull request #62: JCS-220 - Java8 improvement

Posted by GitBox <gi...@apache.org>.
tvand commented on a change in pull request #62:
URL: https://github.com/apache/commons-jcs/pull/62#discussion_r615372186



##########
File path: commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java
##########
@@ -1259,7 +1259,7 @@ private long defragFile(final IndexedDiskElementDescriptor[] defragList, final l
     private IndexedDiskElementDescriptor[] createPositionSortedDescriptorList()
     {
         final List<IndexedDiskElementDescriptor> defragList = new ArrayList<>(keyHash.values());
-        Collections.sort(defragList, (ded1, ded2) -> Long.compare(ded1.pos, ded2.pos));
+        Collections.sort(defragList, Comparator.comparingLong(ded -> ded.pos));

Review comment:
       Don't you think the previous version is easier to understand?




-- 
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



[GitHub] [commons-jcs] tvand merged pull request #62: JCS-220 - Java8 improvement

Posted by GitBox <gi...@apache.org>.
tvand merged pull request #62:
URL: https://github.com/apache/commons-jcs/pull/62


   


-- 
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



[GitHub] [commons-jcs] arturobernalg commented on a change in pull request #62: JCS-220 - Java8 improvement

Posted by GitBox <gi...@apache.org>.
arturobernalg commented on a change in pull request #62:
URL: https://github.com/apache/commons-jcs/pull/62#discussion_r615541987



##########
File path: commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java
##########
@@ -1259,7 +1259,7 @@ private long defragFile(final IndexedDiskElementDescriptor[] defragList, final l
     private IndexedDiskElementDescriptor[] createPositionSortedDescriptorList()
     {
         final List<IndexedDiskElementDescriptor> defragList = new ArrayList<>(keyHash.values());
-        Collections.sort(defragList, (ded1, ded2) -> Long.compare(ded1.pos, ded2.pos));
+        Collections.sort(defragList, Comparator.comparingLong(ded -> ded.pos));

Review comment:
       Hi @tvand 
   I don't know why but i prefer using comparator. Of course it's a personal choice. I rollback this change 
   TY




-- 
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