Problem with remove a node from a list

ArrayList<My_node> list = new ArrayList<My_node>(size_of_list);

My_node is :

public class My_node {

public int key;

public String value;

publicMy_node(int x,String y) {

key = x;

value = y;

}

}

public void del_(int num,String name) {

for(j = 0;j<list.size();j++) {

if(list.get(j).key == num && list.get(j).value == name ) {

list.remove(j);

return;

}

}

}

But unfotrtunately the node is not deleted!!!

Could you plz tell me where is the problem?

Thanks in advance!>

[648 byte] By [g_p_javaa] at [2007-10-2 5:00:03]
# 1
The problem might be that you are using == to compare strings. Try to use the .equals method.if(list.get(j).key == num && list.get(j).value.equals(name))
Learnablea at 2007-7-16 1:04:02 > top of Java-index,Java Essentials,New To Java...
# 2
Thank you very much!Actually,this was the problem (==).Have a nice day!
g_p_javaa at 2007-7-16 1:04:02 > top of Java-index,Java Essentials,New To Java...