Introduction to OOP Chapter 24: Design Patterns : next previous audio real text

An Example Adapter

class MyCollection implements Collection {

	public boolean isEmpty () 
		{ return data.count() == 0; }
	public int size () 
		{ return data.count(); }
	public void addElement (Object newElement) 
		{data.add(newElement); }
	public boolean containsElement (Object test)
		{ return data.find(test) != null; }
	public Object findElement (Object test) 
		{ return data.find(test); }

	private DataBox data = new DataBox();
}
DataBox is some collection that does not support the Collection interface.
Adapters are often needed to connect software from different vendors.
Intro OOP, Chapter 24, Slide 05