Skip to content

Commit 2ac45de

Browse files
committed
Add Tree.of() basic method aliasing JavaTree.of()
1 parent 981da32 commit 2ac45de

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

  • api/src/main/java/com/apicatalog/tree/io

api/src/main/java/com/apicatalog/tree/io/Tree.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
package com.apicatalog.tree.io;
22

33
import java.util.Collection;
4+
import java.util.Map;
45
import java.util.Map.Entry;
56
import java.util.Objects;
67
import java.util.Set;
78
import java.util.function.Consumer;
89
import java.util.stream.Stream;
910

11+
import com.apicatalog.tree.io.java.JavaTree;
12+
1013
/**
1114
* Immutable representation of a tree node where the node and its descendants
1215
* are accessed through a {@link TreeAdapter}.
@@ -39,6 +42,14 @@ public record Tree(
3942
adapter = Objects.requireNonNull(adapter);
4043
}
4144

45+
public static Tree of(Map<?, ?> map) {
46+
return JavaTree.of(map);
47+
}
48+
49+
public static Tree of(Collection<?> collection) {
50+
return JavaTree.of(collection);
51+
}
52+
4253
public Features features() {
4354
return adapter.features();
4455
}

0 commit comments

Comments
 (0)