Prev Next

Java / Set and its implementations

How do you retrieve a element from HashSet?

There is no get method in HashSet as Set is not index based. Use the contains method to determine if the object exists or not, if exists use the Iterator to retrieve element.

More Related questions...

Show more question and Answers...


Comments & Discussions