private static < T > void removeIdentity ( List < T > list , T object ) { Iterator < T > it = list . iterator ( ) ; while ( it . hasNext ( ) ) { if ( object == it . next ( ) ) { it . remove ( ) ; } } }
Removes an object from a list using reference equality .