Hi Friends, Can u give few interview questions which relates
ArrayList and Hashmap. I mean how to link ArrayList and
HashMap.I know this is not good way of asking questions like
this , but i need
Answer / murali,25@gmail.com
HashMap stores key-value pairs. Alternate approach is to have a plain java class with key,value as attributes.
class HashMapAlternate{
Object key;
Object value;
}
You can create objects of HashMapAlternate and store it in arraylist. But HashMap is a better solution because it uses hashing and collision resolution technique which speeds up lookup when number of objects are very large.
Is This Answer Correct ? | 2 Yes | 0 No |
What is a jagged array in java?
What is the purpose of lambda expressions?
How many bits is a string in java?
What is thread safe singleton?
Advantages of Inheritance in java.
What error occurs if a try-catch-finally statement sequence does not have a catch clause?
Does java arraylist maintain insertion order?
What is the need to implement Serializable interface (with no methods) for objects which are to be serialized ? We can write our own functionality which writes objects to streams then why we need to implement and tell JVM that which objects can be serialized.
How does synchronized modifier work?
Can we have more than one package statement in source file ?
Can you tell me range of byte?
What are the supported platforms by java programming language?