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

Can you make a constructor final?

574


Why string is called as immutable?

522


How do you compare arrays in java?

499


What are java threads?

615


What about anonymous inner classes in java?

559






What are default methods ?

572


What function extracts specified characters from a string?

560


Explain about the interpreter in java?

623


what do you understand by synchronization? Or what is synchronization and why is it important? Or describe synchronization in respect to multithreading? Or what is synchronization? : Java thread

482


who can i handle multiple client in RMI

1440


How is it possible for two string objects with identical values not to be equal under the == operator?

522


Difference between string, stringbuffer and stringbuilder?

562


Can classes declared using the abstract keyword cab be instantiated?

557


What is anagram of a string?

515


What is a method in coding?

566