TreeMap stores elements in sorted order because it utilizes a red-black binary tree as its underlying data structure. The basis for this ordering is the 'node element key'.

A. Node element key

This means that elements are arranged based on their key values. The red-black tree structure ensures that the keys are compared and sorted efficiently.

TreeMap Ordering: Why are elements sorted? (Red-Black Tree & Key Comparison)