list乱序输出

	public static  List randomList(List sourceList) {
		if (sourceList == null || sourceList.size() == 0) {
			return sourceList;
		}
		List random = new ArrayList(sourceList.size());
		do {
			int index = Math.abs(new Random().nextInt(sourceList.size()));
			random.add(sourceList.remove(index));

		} while (sourceList.size() > 0);

		return random;

	}

你可能感兴趣的:(java)