Lately when I have been looking at other code, I have noticed that I see one file with multiple interfaces and classes – sometimes extending those interfaces.
What is this called? Is this good / bad practice?
Also, if it is good practice, is there any documentation on how to properly utilize this? If not, is there some other documentation on using interfaces most efficient and the ‘best practices’ for them?
One place they are used is here: Google IoSched
The term for a class that is a member of another class is a nested class. As the tutorial explains, this is done for several reasons:
This technique is often used when the nested class is closely tied to the enclosing class. (For instance, Map.Entry is a nested class of Map and Character.UnicodeBlock is a nested class of Character.)
Nested interfaces serve the same function—to define an interface that is closely connected to the enclosing class.