• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt on Collections Utility Class.  RSS feed

 
Yogendra Joshi
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy folks,

I am learning Collections Utility class and came across several methods out of which copy , rotate and shuffle are the ones which made my mind think for a moment...

Why do we use these methods and in fact where do we use these ? in what scenarios ? Why would one copy a list to another list ? what is the use of rotating a list ? whats the use of shuffling ?

These are the questions which i would request you ranchers to respond to..

Thanks in advance,
Yogendra N Joshi.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the obvious use for shuffling would be when you want to randomize things - a deck of cards, a list of names, a set of numbers...

copy - maybe you need to do something to the elements of a list, but need to maintain the original.

Basically, the answer to the questions of "Why would you need this" is "you might never, but they're awful nice to have when you DO need them".
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!