There are already several βmarkerβ interfaces in the JDK. It just means that it does not need methods.
The most common example is Serializable, which means that a class can be serialized. The library does the rest, so no additional methods are required.
Unclear is RandomAccess, which means the list can be retrieved randomly in an efficient way. The Collections.sort () function uses it.
Another class is Cloneable, which is a marker interface but probably should have a method
public Object clone();
Since Java 5.0 is better to use meta-information, it is to use annotations, but they were not previously available.
Here is a great Jon Skeet answer to a similar marker interface question in java
source share