Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Qestion about HashSet

 
frank yang
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • 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!
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3776
10
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thank u
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic