Em Ter 10 Jan 2006 04:50, Chris Burdess escreveu:
>I would prefer:
>final class EmptyNodeList implements NodeList
>{
> static final EmptyNodeList instance = new EmptyNodeList();
> public final int getLength() {return 0;}
> public final Node item(int index) {return null;}
>}
>That way:
>1. you avoid the unnecessary overhead of a method call (getInstance).
OK.
>2. that which has no need to be public is not public.
Now I understood: If some user application uses gnu.xml.dom.EmptyNodeList, it
loses portability, so it should not be public.
And as it was verified that only DomCharacterData needs to be modified, it
could even be a static inner class, as proposed by Mark Wielaard.
_______________________________________________
Classpath mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath