Java tutorial
//package com.java2s; /* * File: $RCSfile$ * * Copyright (c) 2005 Wincor Nixdorf International GmbH, * Heinz-Nixdorf-Ring 1, 33106 Paderborn, Germany * All Rights Reserved. * * This software is the confidential and proprietary information * of Wincor Nixdorf ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered * into with Wincor Nixdorf. */ import java.util.List; public class Main { /** * Safety delete element included in source collection from target collection * * @param src source collection * @param target target collection */ public static void safetyDeleteCollection(List src, List target) { int srcSize = src.size(); for (int i = 0; i < srcSize; i++) { Object data2Deleted = src.get(i); if (target.contains(data2Deleted)) { target.remove(data2Deleted); srcSize--; } } } }