Prev Next

Java / Set and its implementations

How LinkedHashSet internally works in Java?

LinkedHashSet is an extended version of HashSet. HashSet does not maintain order while LinkedHashSet maintains insertion order. HashSet uses HashMap object internally to store its elements while LinkedHashSet uses LinkedHashMap object internally.

There are 4 constructors in LinkedHashSet class. All these constructors simply call super class constructor i.e., constructor of HashSet class.

More Related questions...

Show more question and Answers...


Comments & Discussions