I want to iterate through two arrays(A, B) based on the sorted order of another array(indexes), which is 10, 34, 32, 21 in this case.
I have a Photo object:poNumber can be null for some photos or all photos in a set. I want to sort a set of photos according to poNumber, so that the lowest poNumber appears first in the sorted set. poNumber may also be duplicated in the set. If poNumber is...
I have Photo object:poNumber can be null for some photos or all photos in a set. I want to sort set of photos according to poNumber, so that lowest poNumber appears first in the sorted set. poNumber may also be duplicate in the set. If poNumber is duplicate then sort...
I've just spent almost hour debugging a List<String> in my code which was being sorted wrong by my Comparator.
I would like to sort the user list based on their status but the order must be based on the order that I set.
I am trying to sort two different ArrayLists of objects by a specific atribute ('Student' objects by "program" and 'Professor' objects by "faculty"). Both classes extend my abstract 'Person' class.
I'm writing a function that takes a list of keyExtractor functions to produce a Comparator (imagine we had an object with many many properties and wanted to be able to arbitrarily compare by a large number of properties in any order).
I have the following List:I need to order it with this condition: The result should be:How can I do it in Java 8?
I have the below code which creates a TreeSet using a comparator based on string length.To my surprise the output of the above is
I like to use Java 8 Comparator to sort a List of an object based on three properties. The requirement is to sort in this order - Name ascending, Age descending, City ascending. If I use reversed() on `Age it reverses previously sorted entries as well. Here is what I've...