List of utility methods to do List Remove
String[] | removeMember(String[] list, String id) Remove all instances of the given id from the member list. List<String> newList = new ArrayList<String>(Arrays.asList(list)); newList.remove(id); return newList.toArray(new String[newList.size()]); |
boolean | removeObject(List Removes the first occurrence in the list of the specified object, using object identity (==) not equality as the criterion for object presence. int i = 0; for (Object o1 : l) { if (o == o1) { l.remove(i); return true; } else i++; return false; |
List | removeObjectList(List remove Object List if (list == null) { list = new ArrayList<T>(1); list.remove(o); return list; |
Object | removeReference(List l, Object o) remove Reference Iterator iter = l.iterator(); while (iter.hasNext()) { Object no = iter.next(); if (no == o) { iter.remove(); return o; return null; |