It's a rather theoretical question, but what kind of interfaces does java have? For example, I know two of them:
- marker interfaces (e.g.
Serializable
, no methods defined, is similar to class-level annotations) - functional interfaces (e.g.
Runnable
, defines only one method)
Are there any more?
UPDATE
It might have been a better way to ask the question like this: in java, what do you use interfaces for? Besides the following ones:
- defining a "contract" for implementing classes ("standard" way)
- marking classes (e.g. for the JVM)
- using for lambda expressions
- using to implement "traits"
UPDATE
I'm not looking for the answer to "why/when/how to use interfaces for defining contracts" (e.g. the "standard" way, how interfaces are ment to be used initially); I'm looking for any other ways how people are using it (e.g. for marking, traits, etc.)