Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Java is an interesting one; while you don't write the sorting algorithm, you do write the sorting conditions, a function that returns a number depending on the compared values. Likewise there's hash functions, although in practice those will be generated by your IDE or Lombok. (I haven't been into Java for a while so there may be better alternatives, iirc Scala and / or Kotlin solve it as well)


Most of the time instead of writing or even using sort you're better off using a sorting collection like TreeSet or TreeMap.

No need to sort everything again after adding 1 element.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: