Create Java tree data structure by using Map which has key & leaf are String

I want to create Java tree data structure by using Map which has key & leaf are String, I can define a Map:

Map<String, Object> tree = new HashMap<>();
Map<String, Object> sub1 = new HashMap<>();
Map<String, String> sub2 = new HashMap<>();
sub2.put("key1", "value1");
tree.put("child1", sub1);
tree.put("child2", sub2);

But it's not type-safe, because when I want to get value, I have to check type is it Map or String, and have not any guarantee of that.

I think about use a wrapper class:

public class Tree {
    private Map<String, Object> map = new HashMap<>();

    public Tree get(String key){
        return new Tree(map.get(key));// but if the result is leaf, I want to return String
    }
}

But if the result is leaf, I want to return String, I create 2nd method to get leaf with String return. But I maybe it's not good way, I want to use one method only to get value, regardless it's leaf or not, I try:

public class Tree implements CharSequence {

}

But still not a good approach, is there any suggestion to create a Tree with node name & value are String by using existing Java HashMap?