Java List Remove removeReference(List l, Object o)

Here you can find the source of removeReference(List l, Object o)

Description

remove Reference

License

Apache License

Declaration

public static Object removeReference(List l, Object o) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.List;
import java.util.Iterator;

public class Main {
    public static Object removeReference(List l, Object o) {
        Iterator iter = l.iterator();
        while (iter.hasNext()) {
            Object no = iter.next();
            if (no == o) {
                iter.remove();/*  w ww.  ja va 2s.c  o m*/
                return o;
            }
        }
        return null;
    }
}

Related

  1. removeItems(List list, T... remove)
  2. removeList(List l)
  3. removeMember(String[] list, String id)
  4. removeObject(List l, T o)
  5. removeObjectList(List list, V o)