Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 1.29 KB

README.md

File metadata and controls

25 lines (16 loc) · 1.29 KB

Code Samples

  • A nice example of the adapter and visitor patterns applied to Google Web Toolkit (GWT). It obviates the standard chaining of instanceofs (see below) to which even googlers fall victim.
if ( o instanceof A ) {
   // cast to A and do stuff
} else if ( o instanceof B ) {
   // cast to B and do stuff
} else if ( o instanceof C ) {
...
}