What is the fastest way in Eclipse to implement a new interface and generate delegate implementations to an existing class?
For instance given an existing class Foo, suppose I want it to implement Iterator<Integer> using a delegate Iterator<Integer>.
Add the delegate field
Iterator<Integer>and theimplements Iterator<Integer>tofooas follows:Select the source menu and then “Generate Delegate Methods”.
Check the iterator box and click OK. The resulting code will look as follows (depending on your formatting settings).