Tag Archives: shuffle

4,249 views

Shuffle array int string Java Android

String [] arOfStrings = {"one", "two", "three"}; List<String> mListOfStrings = new ArrayList<String>(Arrays.asList(arOfStrings)); Collections.shuffle(mListOfstrings); String str = mListOfStrings.get(2);// 2 is index of pozition an element     int [] arOfInt = {1, 2, 3}; List<Integer> mListOfInt = new ArrayList<Integer>(Arrays.asList(arOfInt)); Collections.shuffle(mListOfInt);

Posted in Android Examples Code, Array,List,Collections | Tagged , | Comments Off on Shuffle array int string Java Android
6,227 views

Shuffle List ArrayList Collections Java example

Add and shuffle elements in LinkedList or ArrayList Java basic example. import java.util.Collections; import java.util.LinkedList; import java.util.List;   public class MainClass { public static void main(String[] arg) { String[] arrayOfString = {"nothing", "Hello", "people" , "bye-bye", "hello", "world!", "End" }; … Continue reading

Posted in Android Examples Code, Array,List,Collections | Tagged , , , , , | Comments Off on Shuffle List ArrayList Collections Java example