Guava: My Favorite Feature – Map-Creation
At CoreMedia we decided to collect experiences with Guava – Google Core Libraries for Java 1.6+. It is a well-tested framework for many everyday needs when programming with Java.
Alternatives are self-written and maintained code for such common tasks or (quite popular, too), the different libraries from the Apache Commons project.
Currently I am still in process getting to know Guava’s API (JavaDoc for v12.0). I learned some of its features already digging deeper into Selenium WebDriver, which uses Functions (v12.0 API) to wait for states in your UI.
My favorite feature for today is: On the fly Map-Creation
It uses the builder-pattern which is also used for WebDriver Actions and creating such a map might look like this:
Map<String,?> issueProps = new ImmutableMap.Builder<String,Object>() .put("date", new Date()) .put("priority", HIGH) .put("title", "A bug") .build();
So tell me: What is your favorite feature today using Guava?