0 like 0 dislike
88 views
asked by
Here is an example class. I know the simplest thing would be to change the members from primitive type int to Object Integer and use stream/lambda/sorted, but there may be reasons to only have a primitive type "int" such as space. How could I use the stream api to sort a List by "int" member startRange?
List<DateRange> listToBeSorted =newArrayList<DateRange>();staticprivateclassDateRange{privateint startRange ;privateint endRange ;publicint getStartRange(){return startRange;}publicvoid setStartRange(int startRange){this.startRange = startRange;}publicint getEndRange(){return endRange;}publicvoid setEndRange(int endRange){this.endRange = endRange;}}

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Welcome to Our Online Community - Question and Answer, where you can ask questions and receive answers from other members of the community.
...