Set<Node> nodes = new LinkedHashSet<Node>();where Node is just a data structure like this.
public class Node {
private int id;
private String place;
private String latitude;
private String longtitude;
}
I also override the equals function of Node
public boolean equals(Object o) {
Node n = (Node) o;
if (this.id==n.id) {
return true;
} else {
return false;
}
But still I get duplicate nodes inside my Set. Any idea what went wrong?

New Topic/Question
Reply




MultiQuote



|