如何构数据类型不相同的树结构

现在有三级菜单
每个一级菜单下有若干二级菜单
每个二级菜单下有若干三级菜单
每个三级菜单下有若干商品

如果通过树构建这样的数据结构?

本来通过尝试构建嵌套的map结构来实现,但是发现最内层的数据无法向上层返回,且map不能够通过下标索引来获取对象,故放弃。

然后自己构建了一个TreeNode结构,但是由于最后一级是商品和前面的结构不同,所以有点不知从何下手。

附尝试的代码实现,感觉写的挺糟糕的:

public void initItemCat() {
        for (ItemCat firstItemCat : firstItemCatList) {
            //每一个一级分类对应一个二级map
            Map<ItemCat, List<Item>> newSecondMap=new HashMap<>();
            for (ItemCat secondItemCat : secondItemCatList) {
                if (firstItemCat.getId().longValue() == secondItemCat.getParentId().longValue()) {
                    //每一个二级分类对应一个三级map
                    SecondItemCatList secondItemCatList=
                            new SecondItemCatList();
                    for (ItemCat thirdItemCat : thirdItemCatList) {
                        //每一个三级分类对应一个商品List
                        ThirdItemCatList c3=new ThirdItemCatList();
                        if (secondItemCat.getId().longValue() == thirdItemCat.getParentId().longValue()) {
                            for (Item item : itemList) {
                                if (item.getCid().longValue() == thirdItemCat.getId().longValue()) {
                                   c3.getItemCatListList().add(item);
                                }
                            }
                        }
                    }
                }
            }
        }


    }
可以用两个字段

class Node
{
public List<Node> SubItems;
public List<Product> Products;
}