• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

duplicates??

 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please select collection(s) that do not reject duplicates
1.java.util.List
2java.util.Set
3.java.util.Map
4.All of the above

answer is only 1..
why 3 is incorrect..is he talking Map in terms of Keys which should be unique??
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A Map is not (technically) a Collection. Sets and Lists are derived from the Collection interface, but Maps are not.
 
srikanth reddy
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so is it marc that we can remove blindly Map whenever they ask for collection.......
 
marc weber
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by srikanth reddy:
so is it marc that we can remove blindly Map whenever they ask for collection.......


I don't know that I would say "blindly," because we can see exactly why this is. But if you mean "always" eliminate Map whenever a Collection is asked for, then I would say yes. Consider the following illustration...

Please select Number(s) that are Comparable.
a) Integer
b) Double
c) String
d) BigDecimal
e) BigInteger

All of these are Comparable. But a String is not a Number, just as a Map is not a Collection.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic