TreeMap and TreeSet

suggest change

Versions

[{“Name”:“Java SE 1.2”,“GroupName”:null},{“Name”:“Java SE 1.3”,“GroupName”:null},{“Name”:“Java SE 1.4”,“GroupName”:null},{“Name”:“Java SE 5”,“GroupName”:null},{“Name”:“Java SE 6”,“GroupName”:null},{“Name”:“Java SE 7”,“GroupName”:null},{“Name”:“Java SE 8”,“GroupName”:null},{“Name”:“Java SE 9 (Early Access)”,“GroupName”:null}]

Introduction

TreeMap and TreeSet are basic Java collections added in Java 1.2. TreeMap is a mutable, ordered, Map implementation. Similarly, TreeSet is a mutable, ordered Set implementation.

TreeMap is implemented as a Red-Black tree, which provides O(log n) access times. TreeSet is implemented using a TreeMap with dummy values.

Both collections are not thread-safe.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents