List Array Collection.shuffle消失的项目?

时间:2017-12-28 14:17:09

标签: android collections shuffle

我分手写了一个字。我把它混合了。到目前为止,每件事都还可以。日志中的问题。为什么第二个日志中的信件消失了。

    String word ="windows";

    String[] un_mix = word.split(""); 
    String[] saw = word.split("");

    Log.i(TAG, "un_mix: "+saw[1]+saw[2]+saw[3]+saw[4]+saw[5]+saw[6]+saw[7]);

    List<String> stringList = new ArrayList<String>(Arrays.asList(saw));

    Collections.shuffle(stringList);

    saw = stringList.toArray(new String[stringList.size()]); 

    Log.i(TAG, Cls + "saw_mix: "+saw[0]+saw[1]+saw[2]+saw[3]+saw[4]+saw[5]+saw[6]);
    Log.i(TAG, Cls + "saw_mix2: "+saw[0]+saw[1]+saw[2]+saw[3]+saw[4]+saw[5]+saw[6]+saw[7]);

这是日志记录;

12-28 08:50:06.198 I/Maincls: un_mix: windows // How is it that, Why saw[0] is not necessary ?

12-28 08:50:06.210 I/Maincls: saw_mix: iwwnod // Why is a letter vanished ?

12-28 08:50:06.210 I/Maincls: saw_mix2: iwwnods // which one is saw[0] or saw[7] ?

0 个答案:

没有答案