Why Java List can't remove a dynamic proxy object -


i have proxy object created proxy.newproxyinstance. can't removed list collection:

        vector<thirdpartyinterface>  = new vector<thirdpartyinterface>();     set<thirdpartyinterface>  all2 = new hashset<thirdpartyinterface>();     list<thirdpartyinterface>  all3 = new linkedlist<thirdpartyinterface>();      thirdpartyclass realobject = new thirdpartyclass();     thirdpartyinterface proxy = proxyfactory.newinstance(realobject);      all.addelement(proxy);           if (!all.remove(proxy)) {         system.out.println("     ===>  proxy can't found in vector");     }      all2.add(proxy);     if (!all2.remove(proxy)) {         system.out.println("     ===>  proxy can't found in hashset");     }      all3.add(proxy);     if (!all3.remove(proxy)) {         system.out.println("     ===>  proxy can't found in linkedlist");     } 

this code print:

===> proxy can't found in vector

===> proxy can't found in linkedlist

i tried on real object, works expected.

what reason ?

how can fix it?

my code on jdk7, class has default equals , hashcode method.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -