I need a clarification regarding the use of TreeMap and LinkedList. Do these two structures use compareTo or equals? 

In particular, TreeMap keeps the order in the keys, I suppose using the compareTo method of the class defined for the keys. However, when using get, do they use compareTo or equals to see if the key you pass is contained? 

I have the same doubt for contains and getIndex inside LinkedList.