Skip to content
Tags

,

Guava: My Favorite Feature – Map-Creation

by on May 15, 2012
Guava - by morguefile.com

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?

Featured image: by kahanaboy available at morguefile.com.

From → Dev

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s