Why Java's TreeMap does not allow an initial size?
HashMap reallocates its internals as the new one gets inserted while in TreeMap does not reallocate nodes on adding new ones.
Thus, the size of the TreeMap dynamically increases if needed, without shuffling the internals. So it is meaningless to set the initial size of the TreeMap.
No comments:
Post a Comment