Here you can find the source of createUnmodifiableList(Collection
public static <T> List<T> createUnmodifiableList(Collection<T> coll)
//package com.java2s; /***************************************************************************** * Copyright (c) 2006-2013, Cloudsmith Inc. * The code, documentation and other materials contained herein have been * licensed under the Eclipse Public License - v 1.0 by the copyright holder * listed above, as the Initial Contributor under such license. The text of * such license is available at www.eclipse.org. *****************************************************************************/ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; public class Main { public static <T> List<T> createUnmodifiableList(Collection<T> coll) { List<T> aList;//from w ww .j av a 2 s . com if (coll == null || coll.size() == 0) aList = Collections.emptyList(); else { List<T> newList; if (coll.size() == 1) { T value = (coll instanceof List<?>) ? ((List<T>) coll).get(0) : coll.iterator().next(); newList = Collections.singletonList(value); } else newList = new ArrayList<T>(coll); aList = Collections.unmodifiableList(newList); } return aList; } }