[OpenJDK 2D-Dev] 2D-related types that are candidates to be FunctionalInterfaces in JDK 8
Jim Graham
james.graham at oracle.com
Tue Feb 12 22:58:36 UTC 2013
On 2/11/13 5:01 PM, Joseph Darcy wrote:
>> The pattern that would seem most useful is where the application
>> will need to iterate over a collection of these in parallel, is that
>> correct ?
>
> Not necessary. The guidance I would given is that candidate interfaces
> that are routinely instantiated today using anonymous classes should be
> annotated with @FunctionalInterface. Note that a compiler will allow
> one to use any type that meets the structural definition of a functional
> interface in a lambda expression; adding the @FunctionalInterface
> annotation just documents intent.
I think ImageObserver might be the closest to that criteria, but most
uses would tend to just use an AWT Component since that class already
provides a decent default implementation.
Stroke is out since that is used to implement a fairly extensive set of
calculations (the default BasicStroke implementation takes 3 or 4
classes of a hundred lines of code each to implement [counted from a
foggy memory], or the equivalent amount of native code in the non-open
JDK). I don't think there could be a simple "inlinable" implementation
of that interface.
I'll leave the printing and ImageIO interfaces to Phil or others to
comment on...
...jim
More information about the 2d-dev
mailing list