BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

Java Collections Interview Questions and Answers

Last Updated: September 11, 2022 by Chaitanya Singh | Filed Under: java

Earlier I have shared 100+ tutorials on Java collections framework. In this article I am going to share interview questions on Java collections framework. If you are new to collections, I would recommend you to refer these tutorials before going through the below set of questions as they would help you to learn the basics of collections. Let’s start…

Almost in every interview you would be asked to explain the difference between two collections classes or two collections interfaces, the “difference between” questions have become so popular among interviewers that they comprises around 90% of the questions asked during interviews. I have almost covered all the frequently asked differences in collections. Here are they:

Q) What is the difference between ArrayList and Vector?
A) Refer this article: Arraylist vs. Vector

Q) What is the difference between ArrayList and LinkedList?
A) Refer: ArrayList vs. LinkedList

Q) What is the difference between HashMap and Hashtable?
A) Refer: HashMap vs. Hashtable

Q) What is the difference between HashSet and TreeSet?
A) Refer: HashSet vs. TreeSet

Q) What is the difference between ArrayList and HashMap?
A) Refer: ArrayList vs. HashMap

Q) What is the difference among List, Set and Map interfaces?
A) Refer: List vs. Set vs. Map

Q) What is the difference between Iterator and ListIterator?
A) Refer: Iterator vs. ListIterator

Q) What is the difference between Iterator and Enumeraton?
A) Here are the few differences between them:
1) Iteator can be used on legacy(Vector etc.) classes as well as non-legacy classes (ArrayList, LinkedList etc.), whereas Enumeration is basically used for legacy classes such as Vector.
2) Iterator is comparatively slower than Enumeration.
3) Iterator is fail-fast wheras Enumeration is not.

Q) How to synchronize HashMap?
A) Refer: HashMap synchronization.

Q) How to synchronize ArrayList?
A) Refer: ArrayList synchronization.

Q) What is the difference between fail-fast and fail-safe?
A) fail-fast Iterators throw ConcurrentModificationException when there is a structural modification in underlying collection whereas fail-safe doesn’t throw any exception when they detect structural modification as fail-safe iterators works with clones of underlying collection.

Q) How to convert array to ArrayList?
A) Refer: Array to ArrayList conversion.

Q) How to remove repeated elements from ArrayList?
A) Refer this tutorial.

Q) How to loop ArrayList?
A) Refer this tutorial.

Top Related Articles:

  1. Examples of throws Keyword in Java
  2. How to loop LinkedList in Java
  3. How to sort Hashtable in java
  4. Constructor Overloading in Java with examples
  5. Difference between HashMap and Hashtable

Tags: Interview-Preparation

About the Author

I have 15 years of experience in the IT industry, working with renowned multinational corporations. Additionally, I have dedicated over a decade to teaching, allowing me to refine my skills in delivering information in a simple and easily understandable manner.

– Chaitanya

Comments

  1. Avinash says

    May 11, 2016 at 7:16 AM

    Sir thank you for interview question add some more triky questions and programs, puzzles.

    Thank you

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Java Tutorial

Java Introduction

  • Java Index
  • Java Introduction
  • History of Java
  • Features of Java
  • C++ vs Java
  • JDK vs JRE vs JVM
  • JVM - Java Virtual Machine
  • First Java Program
  • Variables
  • Data Types
  • Operators

Java Flow Control

  • Java If-else
  • Java Switch-Case
  • Java For loop
  • Java while loop
  • Java do-while loop
  • Continue statement
  • break statement

Java Arrays

  • Java Arrays

OOPs Concepts

  • OOPs Concepts
  • Constructor
  • Java String
  • Static keyword
  • Inheritance
  • Types of inheritance
  • Aggregation
  • Association
  • Super Keyword
  • Method overloading
  • Method overriding
  • Overloading vs Overriding
  • Polymorphism
  • Types of polymorphism
  • Static and dynamic binding
  • Abstract class and methods
  • Interface
  • Abstract class vs interface
  • Encapsulation
  • Packages
  • Access modifiers
  • Garbage Collection
  • Inner classes
  • Static import
  • Static constructor

Java Exception Handling

  • Exception handling
  • Java try-catch
  • Java throw
  • Java throws
  • Checked and Unchecked Exceptions
  • Jav try catch finally
  • Exception Examples
  • Exception Propagation

Collections Framework

  • Collections in Java
  • Java ArrayList
  • Java LinkedList
  • Java Vector
  • Java HashSet
  • Java LinkedHashSet
  • Java TreeSet
  • Java HashMap
  • Java TreeMap
  • Java LinkedHashMap
  • Java Queue
  • Java PriorityQueue
  • Java Deque
  • Comparable interface
  • Comparator interface
  • Collections Interview Questions

MORE ...

  • Java Scanner Class
  • Java 8 Features
  • Java 9 Features
  • Java Conversion
  • Java Date
  • Java Multithreading
  • Java I/O
  • Java Serialization
  • Java Regex
  • Java AWT
  • Java Swing
  • Java Enum
  • Java Annotations
  • Java main method
  • Java Interview Q

Copyright © 2012 – 2025 BeginnersBook . Privacy Policy . Sitemap