Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

que from dans test

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
I came across this prob in Dans compresive test, the que was
Entries are organized as key/value pairs.
Duplicate entries replace old entries.
Which interface of the java.util package offers the specified behavior?
potions provided were
a. List
b. Map
c. Set
d. None of the above
correct ans is b
now nowhere in the API i came across - Duplicate entries replace old entries.
Does this mean is that - there is an entry A which maps to DOS a new entry
A which maps to UNIX replaces the dos entry.
So i feel that d should be the correct option.
If 'am wrong pls correct me.
Wating for a quick response.
 
Ranch Hand
Posts: 443
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by varijasmom:
now nowhere in the API i came across - Duplicate entries replace old entries.



From the MAP API:


put
public Object put(Object key,
Object value)
Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for this key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.))

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
API continued.......
The abode method returns previous value associated with specified key, or null if there was no mapping for key...
 
Mona Gadkari
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Krishna n Alton - maybe i skipped this put method while reading the API.
 
There is no "i" in denial. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic