toml4j icon indicating copy to clipboard operation
toml4j copied to clipboard

No Spacing between Map-Entries

Open MaZderMind opened this issue 3 years ago • 1 comments

When Writing Maps with Map-Values, the Writer does not add newlines between the Entries.

Given the following Map:

    HashMap<String, Object> items = new HashMap();

    HashMap<String, Object> item1 = new HashMap();
    item1.put("id", "1");
    item1.put("display", "Foo");

    HashMap<String, Object> item2 = new HashMap();
    item2.put("id", "2");
    item2.put("display", "Bar");

    HashMap<String, Object> item3 = new HashMap();
    item3.put("id", "3");
    item3.put("display", "Moo");

    items.put("foo", item1);
    items.put("bar", item2);
    items.put("moo", item3);

the expected Output would be

[bar]
display = "Bar"
id = "2"

[foo]
display = "Foo"
id = "1"

[moo]
display = "Moo"
id = "3"

while it actually is

[bar]
display = "Bar"
id = "2"
[foo]
display = "Foo"
id = "1"
[moo]
display = "Moo"
id = "3"

MaZderMind avatar Aug 16 '20 19:08 MaZderMind