Add a new API to the abstract Path2D class and its concrete public nested subclasses to enable trimming the internal storage arrays to the currently needed size.
There are no public method to trim the arrays on an existing path object to just the needed size for long term storage. This would be useful when an object will be kept in a static state for a long time and the added storage that was created for potential growth will never be used.
Add a new API method as discussed above
Add this to the abstract class java.awt.geom.Path2D :-
/** * Trims the capacity of this Path2D instance to its current * size. An application can use this operation to minimize the * storage of a path. * * @since 10 */ public abstract void trimToSize();
Add over-rides in java.awt.geom.Path2D.Float and java.awt.geom.Path2D.Double :
@Override public final void trimToSize();