P
Paul Tomblin
I'm finding the same object twice in my HashSet, and since I'm building
that HashSet using
Set getSelectedContentItems()
{
Set ciSet = new HashSet();
Iterator chIt = children.iterator();
while (chIt.hasNext())
{
TreeNode child = (TreeNode)chIt.next();
ciSet.addAll(child.getSelectedContentItems());
}
ciSet.add(myContentItem);
return ciSet;
}
I'm wondering if somehow addAll is adding things without enforcing the
Set's constraint against duplicate items. I've already checked that the
class "MyContentItem" class has a "public boolean equals(Object other)"
method.
that HashSet using
Set getSelectedContentItems()
{
Set ciSet = new HashSet();
Iterator chIt = children.iterator();
while (chIt.hasNext())
{
TreeNode child = (TreeNode)chIt.next();
ciSet.addAll(child.getSelectedContentItems());
}
ciSet.add(myContentItem);
return ciSet;
}
I'm wondering if somehow addAll is adding things without enforcing the
Set's constraint against duplicate items. I've already checked that the
class "MyContentItem" class has a "public boolean equals(Object other)"
method.