Java List Remove Duplicate removeDuplicate(Collection entityList)

Here you can find the source of removeDuplicate(Collection entityList)

Description

Remueve los entities que estan duplicados en la coleccion pasada como parametro Para comparar si los entities estan repetidos se usara su metodo equals

License

Open Source License

Parameter

Parameter Description
entityList a parameter

Declaration

public static List removeDuplicate(Collection entityList) 

Method Source Code


//package com.java2s;
/*/*  w  ww .j  av a  2  s .c  o m*/
 * Copyright (c) 2007 Agile-Works
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Agile-Works. ("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 Agile-Works.
 */

import java.util.*;

public class Main {
    /**
     * Remueve los entities que estan duplicados en la coleccion pasada como parametro
     * Para comparar si los entities estan repetidos se usara su metodo equals
     *
     * @param entityList
     * @return
     */
    public static List removeDuplicate(Collection entityList) {
        Set set = new HashSet(entityList);
        return Arrays.asList(set.toArray());
    }
}

Related

  1. removeDublicates(List l)
  2. removeDup(List lst)
  3. removeDuplicate(List uidList)
  4. removeDuplicate(List dest, List src)
  5. removeDuplicates(int[] list)
  6. removeDuplicates(List list)