Browsed by
Category: Collection Framework

Interview questions for collection framework.

Collection Framework Interview Questions – Set 1

Collection Framework Interview Questions – Set 1

Hello Folks, collection is the favorite and popular among interviewers. Here is the list of most frequently asked collection interview questions and their answers.

Click here if you want to learn more about collection framework and their praticle implementations.

1). What is a collection framework ?

A collection framework is a class library to handle group of objects. Collection framework is implemented in java.util.package which gives you lists, sets, maps and queue to satisfy most of your coding needs.

Read More Read More

How to implement a Stack in Java using Arrays and Linked-List

How to implement a Stack in Java using Arrays and Linked-List

Stack is a fundamental data structure which is extensively used in algorithm design. A Stack can be simply defined as Last In First Out (LIFO) data structure, i.e. the last element added at the top of the stack should be the first element to be removed from the stack. The push method inserts element at the top of the stack while pop method removes top element. In practice we don’t need to implement Stack as it is already available with JDK which is explained here. But, it is always better to have understanding of internal details and implementation of Stack.

Read More Read More

Hashtable Vs HashMap

Hashtable Vs HashMap

An interesting topic in collection framework is HashTable vs HashMap. Interviewers would love to ask questions on Hashtable. The basic difference every java programmer knows is Hashtable is synchronized while it’s not same with HashMap. There are some other differences between Hashtable and HashMap along with some common functionality as well, which we will be discussing in here.

Read More Read More

HashMap Vs WeakHashMap

HashMap Vs WeakHashMap

While working with Collection framework I came to know about WeakHashMap. The first question came to my mind, Java has already lots of concrete classes for Map interface then why another class WeakHashMap. There are some basic difference between HashMap and WeakHashMap. For more about WeakHashMap you can refer here. In interviews, it is very common to ask question for WeakHashMap Vs HashMap. Here are some differences between HashMap and WeakHashMap.

Read More Read More