Java compilations: TreeMap.size () and TreeSet.size (): O (1) or O (n)?
Take a look:
Later, the Java source treemap was used to search Google. (I'm not saying it was snarky - it's not entirely obvious that the source code will be there for googlin ').
tl; dr version is what they track, so O (1).
source to share