|
|
|
|
|
|
|
|
|
|
|
|
|
|
• |
A functor is an object with no data and a
single method.
|
|
• |
Functors
can be passed as parameters.
|
|
• |
Since
these classes are very “small”, they are usually
|
|
|
implemented
as a Nested
Class wherever
they are needed.
|
|
• |
Nested
classes are defined inside other classes and it is
|
|
|
essential
that it be declared as “static”. If it is not declared
|
|
as
“static”, then it is an “inner” class (not nested).
|
|
• |
Nested
classes act as members of the “outer” class, and can
|
|
|
be
declared as private, public, protected, or package visible.
|
|
• |
A
nested class can access private fields and members of the
|
|
|
“outer”
class.
|
|
• |
Functors
can be implemented as a Local Class or as an
|
|
|
Anonymous Class.
|
|