Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Why string is popular hashmap key in java?

Answer Posted / vishalshetkar

Since String is immutable, its hashcode is cached at the time of creation and it doesn’t need to be calculated again. This makes it a great candidate for keys in a Map and its processing is fast than other HashMap key objects. This is why String is mostly used Object as HashMap keys.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you handle java exceptions?

1064


what do you mean by classloader?

1154


How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters in java programming?

1060


Explain a situation where finally block will not be executed?

1089


Is string a class?

1091


What is struts in java?

1089


What is meant by inheritance and what are its advantages?

1160


Can you write a java class that could be used both as an applet as well as an application?

998


what are synchronized methods and synchronized statements? : Java thread

1045


Why does java have different data types for integers and floating-point values?

1061


What are void pointers?

1360


What language is java written?

1051


What is the dot operator?

1061


What is jit compiler ?

1036


Is alive and join method in java?

1254