1. In the sort method, write a comparator for Stock: 1.1. Sort first by name in alphabetical order 1.2. Sort second by date without accounting for hours, minutes, and seconds (with the newest on top), and then by profit from positive to negative ... open 125.64 and last 126.74. Here the gain is 126
Knowledge is power!
You must be signed in to leave a comment
14 January 2022, 22:06
Seems weird, but Intellij is insisting there is no compareTo method for doubles. Was able to handle getting compareTo for the String and Date components, but when trying to use it to compare two doubles, "compareTo" is in red and it says it doesn't know what it is. Not a huge deal to write a few if blocks to do it manually, but still... weird. Also, I feel like lines 28-31 are worth an entire chapter of lessons.
18 April, 04:30
Double.compare(double1, double2) it's nice useful method for this
Dawid Bujnicki Junior Developer
20 September 2021, 22:39
Tip: Alphabetically does not mean that we have to ignore case sensivity :) Fun task tho, but tiny bit explanation to formatting thing would be useful