Here you can find the source of remove(List
public static <T> boolean remove(List<T> list, T value)
//package com.java2s; //License from project: Open Source License import java.util.List; import java.util.Set; public class Main { public static <T> boolean remove(List<T> list, T value) { if (list == null || value == null) { return false; }//w w w . j a v a 2 s .com for (T t : list) { if (t.hashCode() == value.hashCode()) { list.remove(t); return true; } } return false; } public static <T> boolean remove(Set<T> set, T value) { if (set == null || value == null) { return false; } for (T t : set) { if (t.hashCode() == value.hashCode()) { set.remove(t); return true; } } return false; } }