1.

Why Does Equals () Only Do A == Check?

Answer»

In JDOM two Content OBJECTS are only equal if they're the exact same OBJECT. This lets a call LIKE list. Remove (elem) remove only the exact Element passed in, not any element that's EQUIVALENT. That's a very important distinction. Doing a full equals() on an Element would require recursing down the tree, and in general we believe it unlikely you'll want to know if this element and all its children are equivalent to another ONE. If you really do want to know you can write some comparison code yourself that checks only as much as you want to check (maybe the name/namespaces only) instead of doing a full recurse.

In JDOM two Content objects are only equal if they're the exact same object. This lets a call like list. Remove (elem) remove only the exact Element passed in, not any element that's equivalent. That's a very important distinction. Doing a full equals() on an Element would require recursing down the tree, and in general we believe it unlikely you'll want to know if this element and all its children are equivalent to another one. If you really do want to know you can write some comparison code yourself that checks only as much as you want to check (maybe the name/namespaces only) instead of doing a full recurse.



Discussion

No Comment Found