If you want to know all the details, then you can lookup the source code for class TreeMap. In your JDK installation directory, there is a file named
src.zip. In there you will find the source code for all the standard Java API classes, including the source code for java.util.TreeMap.
As the documentation says, it is implemented with a
red-black tree. And Wikipedia says:
A red-black tree is a binary search tree where each node has a color attribute, the value of which is either red or black. In addition to the ordinary requirements imposed on binary search trees, the following additional requirements apply to red-black trees: ...