Skip to content

Commit

Permalink
Simplified poly creation (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
denis256 authored Apr 6, 2024
1 parent 94220ad commit 3a00c4a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public class BasicPoly implements Poly, Serializable {
@Setter
protected Map<String, Object> metadata;

public BasicPoly(Map<String, Object> data) {
this.data = data;
this.metadata = new ConcurrentHashMap<>();
}

public BasicPoly(Map<String, Object> data, Map<String, Object> metadata) {
this.data = data;
this.metadata = metadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,21 @@ public class BasicPolyList implements PolyList<BasicPoly>, Serializable {
@Setter
protected Map<String, Object> metadata;

public BasicPolyList(Map<String, Object> metadata, List<BasicPoly> list) {
public BasicPolyList(List<BasicPoly> list) {
this(list, new ConcurrentHashMap<>());
}

public BasicPolyList(List<BasicPoly> list, Map<String, Object> metadata) {
this.list = list;
this.metadata = metadata;
}

public BasicPolyList() {
this(new ConcurrentHashMap<>(), new CopyOnWriteArrayList<>());
this(new CopyOnWriteArrayList<>(), new ConcurrentHashMap<>());
}

public BasicPolyList(Collection<BasicPoly> source) {
this(new ConcurrentHashMap<>(), new CopyOnWriteArrayList<>(source));
this(new CopyOnWriteArrayList<>(source), new ConcurrentHashMap<>());
}

public static BasicPolyList newList() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public class BasicPolyMap implements PolyMap<BasicPoly>, Serializable {
@Setter
private Map<String, Object> metadata;


public BasicPolyMap(Map<String, BasicPoly> map, Map<String, Object> metadata) {
this.map = map;
this.metadata = metadata;
}

public BasicPolyMap() {
super();
map = new ConcurrentHashMap<>();
Expand Down

0 comments on commit 3a00c4a

Please sign in to comment.