Sign in
Log inSign up

How to get the overridden values from map ??

nijan gouda's photo
nijan gouda
·Dec 13, 2017

Suppose if i have Map object I am adding. object in map.

As we know map doesn't allow duplicate keys?

Map<Integer, String> map=new HashMap<>();

map.put(1, "Test");

map.put(2, "Testing");

map.put(1, "Duplicate key");

we know the key(1) is overridden with new value "Duplicate",

How do we find all keys which is overridden ???

And please can you Guys how java handles collision in Map??

Thanks in advance.

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct