Friday, 24 February 2012

Java: inline initializer for Map

Flurry has a function

FlurryAgent.logEvent(String event, Map<String,String> parameters)

It can be called with an inline initializer like this

FlurryAgent.logEvent("event", new HashMap<String,String>() {{
  put("key1","val1");
  put("key2","val2");
}});


No comments:

Post a Comment