Skip to content
javabypankaj
HomeLibraryPopularCommunity
03
Collections
14 topics · 67 questions
1Collections Framework Overview0/442List: ArrayList & LinkedList0/773Queue, Deque & Stack0/884HashMap Internals0/10105LinkedHashMap, TreeMap & Map Comparisons0/666Set: HashSet, LinkedHashSet, TreeSet0/57Comparable & Comparator0/448Iterator & Removing During Iteration0/339Map Operations: compute, merge, putIfAbsent0/2210Immutable Collections0/3311Generics & Type Safety0/7712Special Maps & Collections0/5513Spliterator0/2214Build Your Own HashMap0/11
1Collections Framework Overview42List: ArrayList & LinkedList73Queue, Deque & Stack84HashMap Internals105LinkedHashMap, TreeMap & Map Comparisons66Set: HashSet, LinkedHashSet, TreeSet57Comparable & Comparator48Iterator & Removing During Iteration39Map Operations: compute, merge, putIfAbsent210Immutable Collections311Generics & Type Safety712Special Maps & Collections513Spliterator214Build Your Own HashMap1
14 topics67 Qs0%
01Core Java17002OOP3203Collections6704Exception Handling2805Concurrency & Multithreading12706Java Streams, Lambda & Functional Programming32807Spring & Spring Boot2608Transactions3209JPA & Hibernate6910Microservices19411Kafka & Messaging9112DevOps, CI/CD & Tooling13313Database & SQL14114REST API & Web4015Design Patterns & LLD5716Advanced Java7117Coding Problems: DSA49218AWS & Cloud4119Data Engineering19420QA, Testing & SDET4121System Design3522Security2023Behavioral / HR: STAR Method37
14Topics
67Questions
0%Complete
6 of 14 topics
Topics
1Collections Framework Overview0/442List: ArrayList & LinkedList0/773Queue, Deque & Stack0/884HashMap Internals0/10105LinkedHashMap, TreeMap & Map Comparisons0/66
6Set: HashSet, LinkedHashSet, TreeSet0/55
7Comparable & Comparator0/448Iterator & Removing During Iteration0/339Map Operations: compute, merge, putIfAbsent0/2210Immutable Collections0/3311Generics & Type Safety0/7712Special Maps & Collections0/5513Spliterator0/2214Build Your Own HashMap0/11

Set: HashSet, LinkedHashSet, TreeSet

Collections·Topic 6 of 14·5 questions
Q1How does HashSet work internally?

HashSet is a HashMap in disguise: each element is a key in the HashMap, and every value is the same shared dummy constant PRESENT.

Read Answer
Q2What is the difference between HashSet, LinkedHashSet, and TreeSet?

HashSet is unordered O(1), LinkedHashSet is insertion-ordered O(1), and TreeSet is sorted O(log n) – each backed by the corresponding Map implementation.

Read Answer
Q3What is the difference between HashSet and LinkedHashSet?

HashSet is unordered with O(1) operations; LinkedHashSet adds insertion-order iteration at the cost of slightly more memory per element.

Read Answer
Q4How do you remove duplicates while keeping insertion order?

Wrap the list in a LinkedHashSet to remove duplicates while preserving insertion order; wrap back in ArrayList if you need a List.

Read Answer
Q5What happens when you convert List to Set?

Converting a List to a Set removes duplicates, and the Set implementation you choose determines whether elements are unordered (HashSet), insertion-ordered (LinkedHashSet), or sorted (TreeSet).

Read Answer
Previous · Topic 5LinkedHashMap, TreeMap & Map Comparisons6 questionsNext · Topic 7Comparable & Comparator4 questions
javabypankaj© 2026 javabypankaj
PrivacyTerms
HomeSearchLibrary