I have an HashMap object, which has with key and value pair.
It has 10 keys and values in that object. Now the question
is I want insert new key and value in middle or any where in
that list but not at the end or at the top. Is it possible
or not. If yes how can we achieve this one?

Answer Posted / alka

It is not in the programmers hand to decide location of any
key/value pair in hashmap.These pairs are randomly placed in
Hashmap based on some calculated hash codes.

Is This Answer Correct ?    20 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is string immutable in java?

771


How much is a java license?

704


What is the purpose of the strictfp keyword?

836


Why are the objects immutable in java?

739


Explain abstract class in java?

758


What is main method?

766


Difference between ‘is-a’ and ‘has-a’ relationship in java?

773


What do you mean by scope of variable?

663


How an object is serialized in java?

746


What are identifiers in java?

776


Explain polymorphism citing an example.

803


Is break statement can be used as labels in java?

705


How do you do math powers in java?

805


Write a program in java to find the maximum and minimum value node from a circular linked list.

762


Why string objects are immutable in java?

801