The time complexity of Iterator() in java
<p>I am new to Java. I have a question about the time complexity of java iterator().</p>

<pre><code>Set&lt;Integer&gt; set = new HashSet&lt;&gt;();

Iterator&lt;Integer&gt; iter = set.iterator(); ==&gt; (2)
</code></pre>

<p>I wanna know what is the time complexity of step 2? It is const time <strong>O(1)</strong> or it depends on the size of set?</p>

<p>Thanks</p>