Is it possible to implement class adapter pattern in Java?
I'm trying to read everything on the internet but still have found an example.
Is it possible to implement class adapter pattern in Java?
I'm trying to read everything on the internet but still have found an example.
It is possible, but pure interfaces must be used instead of abstract classes, since Java does not support multiple inheritance.
There are two variations of the Adapter pattern: inheritance-based (a.k.a. class Adapter) and composition-based. The inheritance variation requires the use of multiple inheritance, which doesn't exist in Java and therefore it's impossible to implement. But of course, you can do the composition-based implementation, without any problems.