Java – an adapter class

adapterandroidjava

I googled and investigated, but I still need some clarification: Are an adapter class and a controller class similar? If not, in what way they do differ?

Kindly explain.

Best Solution

Adapter is a pattern that provides default (often empty) implementation of interface or abstract class. For example MouseAdapter provides empty implementation of MouseListener interface. It is useful because very often you do not really use all methods declared by interface, so implementing the interface directly is very verbose.

Controller is a part of MVC - Model-View-Controller pattern. No direct relation with Adapter.