-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
sort by date without obeying folder/files #1369
Conversation
@AndyScherzinger @davivel @przybylski please review |
} else if (o2.isFolder()) { | ||
return 1; | ||
} else if (o1.getModificationTimestamp() == 0 || o2.getModificationTimestamp() == 0){ | ||
if (o1.getModificationTimestamp() == 0 || o2.getModificationTimestamp() == 0){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like that if there is no timestamp we artificially making it equal with everything. This leads to unexpected behavior when we do have multiple zeros in collection.
I would rather not take any special care of this and boil down compare method to something like this:
public int compare(OCFile o1, OCFile o2) {
return val * (o1.getModificationTimestamp() - o2.getModificationTimestamp());
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but this is already the current behaviour.
So, we should discuss this in another issue?
(Although I do not know how often this problem might occur as the modification timestamp should always be set, or?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case its ok for me to be merged
To be done in #2710 |
ref: #1334