Java List Shuffle shuffle(List list)

Here you can find the source of shuffle(List list)

Description

shuffle

License

Open Source License

Declaration

private static <T> List<T> shuffle(List<T> list) 

Method Source Code

//package com.java2s;
/**//  ww w.  j a v  a 2s.com
 * Copyright (c) 2010, 2011 Darmstadt University of Technology.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Sebastian Proksch - initial API and implementation
 */

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

public class Main {
    private static <T> List<T> shuffle(List<T> list) {
        List<T> copy = new ArrayList<T>(list);
        Collections.shuffle(copy);
        return copy;
    }
}

Related

  1. shuffle(List list)
  2. shuffle(List list, int count)
  3. ShuffleList(final Collection list)