Skip to content
This repository has been archived by the owner on May 1, 2021. It is now read-only.

Commit

Permalink
allow map builder to use existing map.
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbowdashlabs committed Jul 10, 2020
1 parent 8f76696 commit 0a97c8e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>de.eldoria</groupId>
<artifactId>eldo-utilities</artifactId>
<version>1.0.6</version>
<version>1.0.7</version>
<packaging>jar</packaging>
<name>Eldo Utilities</name>
<url>https://github.com/eldoriarpg/EldoUtilities/wiki</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public static Builder newBuilder() {
return new Builder();
}

public static Builder newBuilder(Map<String, Object> map) {
return new Builder(map);
}

public static <T, U> BiFunction<T, U, String> keyToString() {
return (k, v) -> k.toString();
}
Expand All @@ -35,7 +39,15 @@ public static TypeResolvingMap mapOf(Map<String, Object> serialized) {
}

public static final class Builder {
private final Map<String, Object> serialized = new LinkedHashMap<>();
private final Map<String, Object> serialized;

public Builder() {
serialized = new LinkedHashMap<>();
}

public Builder(Map<String, Object> map) {
serialized = new LinkedHashMap<>(map);
}

public Builder add(String key, Object value) {
this.serialized.put(key, value);
Expand Down

0 comments on commit 0a97c8e

Please sign in to comment.