I found myself using a TreeMap simply because I needed the capability of looking something up with the floorEntry() (and ceilingEntry()) methods. This obviously make the code a bit clumsy. So does anyone happen to know if there is any built-in sorted list that would offer the same functionality as floorEntry()?
So for instance, I have a List<Integer> list
. and I have a value int num
. I'd like to get the max element in list
that is not greater than num