Am Mittwoch, den 29.06.2005, 13:59 -0600 schrieb Tom Tromey: > >>>>> "Roman" == Roman Kennke <[EMAIL PROTECTED]> writes: > > Roman> I have optimized this. Now no new array is allocated at all. A List > Roman> implementation is returned instead that iterates over the components > Roman> and returns only the visible ones. The List itself is cached in a > Roman> WeakHashMap, so multiple layouts for one Container will reuse the same > Roman> List impl, still if the Component (more precisely: its children array) > Roman> is no longer in use, it can be garbage collected. > > This might be heavier than the original.
I don't think so. It should be quite efficient performance-wise as well as allocation-wise. You could be right though that handling this on a per case basis inside the layout managers could be slightly more efficient, though a little bit ugly. I will meditate a little over it and maybe remove all this crap. The reason I started this stuff was because I thought that 2 things are quite common in LayoutManagers: iterating over the visible children and counting them. Both is done here through the iterator() and size() methods. ... /me will think about that deeper. /Roman _______________________________________________ Classpath-patches mailing list [email protected] http://lists.gnu.org/mailman/listinfo/classpath-patches
