• Post Reply Bookmark Topic Watch Topic
  • New Topic

JAVA Shuffle array ?  RSS feed

 
Iliyan Ivanov
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to shuffle an array easily in J2SE and J2ME ??
Thanks
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.util.Collections has two methods that can shuffle a List. There are no similar methods in java.util.Arrays. Fortunately, there is a way to create a List view for an array. The resulting code is quite easy:
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!