Knowledge is power!

  • 26
  • Locked
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
You can't complete this task, because you're not signed in.
Comments (2)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Justin Smith
Level 29 , Greenfield, USA, United States
14 January, 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.
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