title: Why isn't TreeSet's first method implemented in O(1) time?
body: <p>My understanding of<code>TreeSet</code>'s <code>first()</code> method is that it will take <code>O(log n)</code> based of the explanation in <a href="https://stackoverflow.com/questions/5214670/what-is-the-time-complexity-of-ordered-operations-in-treeset">this</a> answer.</p>
  <p>The explanation in that answer says that for it to be <code>o(1)</code> we would need to maintain a pointer to the first element in the <code>TreeSet</code> which would add a constant time to every operation. However, doesn't Java already maintain such a pointer since the <code>iterator()</code> method of a collection must be <code>O(1)</code>? i.e couldn't we just instantiate the iterator in <code>O(1)</code> and get the first element using <code>next()</code> in constant time?</p>