• Post Reply Bookmark Topic Watch Topic
  • New Topic

When and why should one use set?  RSS feed

 
Nalin Bakshi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of all the things in collection classes, I have never used Set.
My question:

1. Why should one use Set?
2. When should one use Set?
 
rakesh sugirtharaj
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you are not worried about the ordering and you want a unique grouping of objects.
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need a trip to the Java Tutorials. It tells you about sets in that section. A Set is so called because it implements the mathematical concept of a set.
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to JavaRanch
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!