• 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

Qestion about HashSet

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Classes that implement the interfaces use different storage mechanisms.
the Hashing Supports insertion, deletion and growing the store. Indexed access is slower.
But searching is faster.
However, requires the use of unique keys for storing data elements.
Quote from chairyuan's notes
My question if two statement below
Q1 The elements in the collection are guaranteed to be unique.
Q2 The elements in the collection are accessed using a unique key.
I think both are coorect .But the Q2 is seemt to incorrect.
Pls tell me which is true?
Thank u very much!
 
Enthuware Software Support
Posts: 4803
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by frank yang:
My question if two statement below
Q1 The elements in the collection are guaranteed to be unique.


Elements in a Set are guaranteed to be unique. Collection is a super-interface of Set. List is also a Collection and can contain duplicate values.


Q2 The elements in the collection are accessed using a unique key.


No, elements in a Map are accessed using a unique key. Elements in a collection are accesed using an Iterator. Although elements in a List can also be accessed using an index.
HTH,
Paul.
 
frank yang
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank u
 
Can you really tell me that we aren't dealing with suspicious baked goods? And then there is this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic