日期:2014-05-16  浏览次数:20950 次

RandomAccess接口的使用
引子:
RandomAccess在类Collections的shuffle()方法中的使用:(jdk源码如下)
Java代码  收藏代码
  1. <span style="font-size: small;">/** 
  2.      * Randomly permute the specified list using the specified source of 
  3.      * randomness.  All permutations occur with equal likelihood 
  4.      * assuming that the source of randomness is fair.<p> 
  5.      * 
  6.      * This implementation traverses the list backwards, from the last element