DEV Community

loading...

Discussion on: Java Data Structures

vrnsky profile image
Yegor Voronyansky Author

At the docs.oracle.com/javase/7/docs/api/... we see that is provide contant time for basic operation, and O(n) for iteration over a LinkedHashSet that means next require time proportional to the size of the set

Thread Thread
hamidur01 profile image
Hamidur Rahman

Then I think you meant constant time O(1) for add, contains, and remove. Iteration on any structure is always O(n).

Thread Thread
vrnsky profile image
Yegor Voronyansky Author • Edited

Yeah! for this operation I meant

Forem Open with the Forem app