Here you can find the source of copyExcept(E[] orig, E excludedElem)
public static <E> List<E> copyExcept(E[] orig, E excludedElem)
//package com.java2s; /******************************************************************************* * Copyright (c) 2007 DSource.org and others. * 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:// w w w . ja va 2 s .co m * Bruno Medeiros - initial implementation *******************************************************************************/ import java.util.ArrayList; import java.util.List; public class Main { /** Creates a List copy of orig, with all elements except elements equal to excludedElem. */ public static <E> List<E> copyExcept(E[] orig, E excludedElem) { List<E> rejectedElements = new ArrayList<E>(orig.length); for (int i = 0; i < orig.length; i++) { if (!orig[i].equals(excludedElem)) { rejectedElements.add(orig[i]); } } return rejectedElements; } }