Why doesn’t Collection extend Cloneable and Serializable

From Sun FAQ Page: Many Collection implementations (including all of the ones provided by the JDK) will have a public clone method, but it would be mistake to require it of all Collections. For example, what does it mean to clone a Collection that’s backed by a terabyte SQL database? Should the method call cause … Read more

What is fail-fast Property

At high level – Fail-fast is a property of a system or software with respect to its response to failures. A fail-fast system is designed to immediately report any failure or condition that is likely to lead to failure. Fail-fast systems are usually designed to stop normal operation rather than attempt to continue a possibly-flawed … Read more

What does Synchronized means in Hashtable Context

Synchronized means only one thread can modify a hash table at one point of time. Any thread before performing an update on a hashtable will have to acquire a lock on the object while others will wait for lock to be released In the context of Hashtable in Java, the synchronized keyword is used to … Read more

Difference Between HashMap and HashTable? Compare Hashtable vs HashMap

Both Hashtable & HashMap provide key-value access to data. The Hashtable is one of the original collection classes in Java (also called as legacy classes). HashMap is part of the new Collections Framework, added with Java 2, v1.2. There are several differences between HashMap and Hashtable in Java as listed below The HashMap class is … Read more

What is HashMap and Map

Map is Interface which is part of Java collections framework. This is to store Key Value pair, and Hashmap is class that implements that using hashing technique. In Core Java: Map: A Map is an interface in Java that represents a collection of key-value pairs, where each key is associated with exactly one value. It … Read more