Skip to content

nathanmyles/MapFlattener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MapFlattener

Convert nested Maps into flat Maps and then expand them back!

Build Status

Coverage Status

Easy to use

Create an instance of the MapFlattener class

MapFlattener mapFlattener = new MapFlattener();

By default, key concatenation uses dots, but you can override this like so

mapFlattener.withSeparator("$");

Now you can start flattening and expanding maps

// flatten it!
Map<String, Object> flattenedMap = mapFlattener.flattenMap(map);

// expand it!
Map<String, Object> map = mapFlattener.expandMap(flattenedMap);

Check out the tests for more examples

Pull it from Maven Central!

Maven Central

You can pull from the central maven repository, just add this to your pom.xml file's <dependencies> section:

<dependency>
    <groupId>com.nathanmyles</groupId>
    <artifactId>mapflattener</artifactId>
    <version>1.0</version>
</dependency>

License

This project is licensed under The Apache License, Version 2.0.

About

Convert nested Maps into flat Maps and then expand them back!

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages