Quote

"For like a shaft, clear and cold, the thought pierced him that in the end the Shadow was only a small and passing thing: there was light and high beauty for ever beyond its reach." -- J.R.R. Tolkien

Sunday, February 23, 2014

Cast Java Map to ConcurrentMap

I couldn't find a quick and easy example of this on Google, so here you go:

Using Google Guava:

Map<String, String> map;
ConcurrentMap<String, String> ccMap = new MapMaker().weakKeys().weakValues().makeMap();
ccMap.putAll(map);

No comments:

Post a Comment