Actually that breaks the contract according to the API that the Iterator
must be immutable.
Ed Burns wrote:
>>>>>>On Sat, 02 Jul 2005 14:17:55 -0600 (MDT), Adam Winer <ADAM.WINER_at_oracle.com> said:
>>>>>>
>>>>>>
>
>AW> Jacob,
>AW> Great to see some optimizing of this code - getFacetsAndChildren()
>AW> is desperately in need of it - but the new getFacetCount()
>AW> API's got to be brought over to the EG. Where I'll +1 it.
>
>AW> Also, you could optimize getFacetsAndChildren() further
>AW> to deal with the common scenarios of children but no
>AW> facets or facets but no children:
>
>AW> if (getFacetCount() == 0) {
>AW> if (getChildCount() == 0) { return EMPTY_ITERATOR };
>AW> return getChildren().iterator();
>AW> }
>AW> else if (getChildCount() == 0) {
>AW> return getFacets().values().iterator();
>AW> }
>AW> else {
>AW> ... old code ...
>AW> }
>
>AW> ...saving a whopping one object allocation, but it does
>AW> add up with all the tree walking we do.
>
>I've checked this in.
>
>Ed
>
>
>
--
Jacob Hookom - Minneapolis
--------------------------
http://hookom.blogspot.com