The Google Collections Library, An Update
For this to compile correctly, the numbers in BiMap must also have been declared final. Because numbers is a local variable, the scoping issues surrounding the alteration of the numbers reference once the Function has been declared could lead to unintended results; hence, the numbers BiMap must be declared final to compile correctly.
If this article brings home anything, it should be a reinforcement of the warning that the Google Collections Library is subject to changes in the API and will be for some time to come. This warning is not intended to put you off using the library by any means, but just to make sure you know what you are getting in to. None of these changes should be a problem for anyone with a decent search/replace in their editor or IDE, but if this kind of thing really bothers you, you may want to think twice before integrating the Google Collections Library throughout your multi-million line project, at least until the API is a bit more stable.
If you would like to keep track of the latest changes in the API, I can recommend the PublicObject blog by Jesse Wilson as a good way to keep up. Jesse is a regular contributor to the Google Collections Library and, through his blog, follows the latest developments in the Google Collections Library as well as discussing many other topics of interest to Java developers.
About the Author
Dick Wall is a developer advocate for Java technologies at Google, based in Mountain View, part of the Google Developer Program. He also co-hosts the Java Posse podcast, a regular Java-centric news and interviews show that can be found at http://javaposse.com.
Page 2 of 2