Skip to content

Instantly share code, notes, and snippets.

@hemanth415
Last active March 28, 2018 14:06
Show Gist options
  • Save hemanth415/1e155d331a7a2cef8ff11ab3ba6bd1f4 to your computer and use it in GitHub Desktop.
Save hemanth415/1e155d331a7a2cef8ff11ab3ba6bd1f4 to your computer and use it in GitHub Desktop.
Convert Legacy Dictionary to a Map in java
// Using Google Core Library and Java 8
public Map<String, Object> transformDictionary(Dictionary<String, Object> props) {
Iterator<String> keysIter = Iterators.forEnumeration(props.keys());
return Maps.toMap(keysIter, props::get);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment