Other platforms do use string-keyed maps for this sort of thing, but there are some weaknesses with that approach:
- it is impossible to enforce dependencies. With Lookup, a module's code cannot request an object unless it can access the object's class, and it won't be able to access the object's class unless it declares a dependency on the API module that defines it. (A <T> Map<Class<T>,T> would do the same job as Lookup.)
- The class of values in a map can change without notice - so if you have (SomeIface) foo = (SomeIface) globalMap.get("foo"), some new version of the module that provides "foo" can change the return type, causing ClassCastExceptions; with Lookup, you cannot ever get an object that is not of the type you passed in the request - so Lookup's approach is more robust. (Again, a generics-aware Map might be able to solve this.)
- Lookup supports listening to changes in the result.
- Lookup supports multiple instances for one key. (Sort of like <T> Map<Class<T>,List<T>>)
There are some other capabilities of Lookup (such as getting classes of results without instantiating them, and naming result items) but these are rarely used in practice.
Lookup is very powerful, yet simple and generic; people quickly learn to love it, once they realize what it can do.
Source: NetBeans FAQ