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

JCS-220 - Java8 improvement #62

Merged
merged 1 commit into from
May 24, 2021
Merged

JCS-220 - Java8 improvement #62

merged 1 commit into from
May 24, 2021

Conversation

arturobernalg
Copy link
Member

@arturobernalg arturobernalg commented Apr 13, 2021

  • Use method reference
  • Use lambda

@@ -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));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@tvand tvand merged commit 26c3b6f into apache:master May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants