Copyright © Philip M. Parker, INSEAD. Terms of Use.

(From Wikipedia, the free Encyclopedia)
There are two types of adapter patterns:
External Links
/* * Java code sample */interface Stack { public void push (Object); public Object pop (); public Object top (); }
/* DoubleLinkedList */ class DList { public void insert (DNode pos, Object o) { ... } public void remove (DNode pos, Object o) { ... } public void insertHead (Object o) { ... } public void insertTail (Object o) { ... } public Object removeHead () { ... } public Object removeTail () { ... } public Object getHead () { ... } public Object getTail () { ... } }
/* Adapt DList class to Stack interface */ class DListImpStack extends DList implements Stack { public void push (Object o) { insertTail (o); } public Object pop () { return removeTail (); }
public Object top () { return getTail (); } }
Source: the above text is adapted by the editor from Wikipedia, the free encyclopedia under a copyleft GNU Free Documentation License (GFDL) from the article "Adapter pattern."
Copyright © Philip M. Parker, INSEAD. Terms of Use.