Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {
    public static void main(String args[]) {
        // create array list object       
        List<String> arrlist = new ArrayList<String>();

        // populate the list
        arrlist.add("A");
        arrlist.add("B");
        arrlist.add("from java2s.com");

        System.out.println("Initial collection: " + arrlist);

        // shuffle the list
        Collections.shuffle(arrlist);

        System.out.println("Final collection after shuffle: " + arrlist);
    }
}