> Closures can also be assigned to SAM types. A SAM type is any type that is > (1) abstract and > (2) has only one undefined method in it. > In other words, any interface that mentions only 1 method, and any abstract > class where all > but 1 method has an implementation. Like FileFilter and Runnable.
If an interface declares methods already defined in Object, they don't count either... For instance, the interface java.util.Comparator has two methods: int compare(T o1, T o2); boolean equals(Object obj); The second method is in there because it has some javadoc on it. Since Object has a method with the same signature, Comparator still qualifies as a SAM. Roel -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
