[jdom-interest] Parent & Child
Jason Hunter
jhunter at acm.org
Mon Jun 2 11:39:01 PDT 2003
phil at triloggroup.com wrote:
> I liked these new interfaces because it really prevent people from using instanceof and casting object.
> Why not now adding a getChildType() to Child, which returns an integer constant for each different child?
> When looking at ContentList, I can see:
> public void add(int index, Object obj) {
> if (obj instanceof Element) {
> add(index, (Element) obj);
> }
> ....
> A switch using a constant may perform better.
I'd like to see numbers for that. In my mind you don't change an API
for theoretical performance improvements.
If you or someone wants to experiment, that'd be cool.
> Moreover, I think that the argument should be now "Child Obj" instead of
> "Object obj", should'nt it?
We have to implement the List interface.
-jh-
More information about the jdom-interest
mailing list