public static Map<String, Object> merge(Map<String, Object> a, Map<String, Object> b) {
        if (a == null && b == null) {
            return null;
        }

        if (a == null || a.isEmpty()) {
            return copyMap(b);
        }

        if (b == null || b.isEmpty()) {
            return copyMap(a);
        }

        Map copy = copyMap(a);

        Map<String, Object> copyMap = b
            .entrySet()
            .stream()
            .collect(
                () -> newHashMap(copy.size()),
                (m, v) -> {
                    Object original = copy.get(v.getKey());
                    Object value = v.getValue();
                    Object found;

                    if (value == null && original == null) {
                        found = null;
                    } else if (value == null) {
                        found = original;
                    } else if (original == null) {
                        found = value;
                    } else if (value instanceof Map && original instanceof Map) {
                        found = merge((Map) original, (Map) value);
                    } else if (value instanceof Collection
                        && original instanceof Collection) {
                        try {
                            found = Lists
                                .newArrayList(
                                    (Collection) original,
                                    (Collection) value
                                )
                                .stream()
                                .flatMap(Collection::stream)
                                .toList();
                        } catch (Exception e) {
                            throw new RuntimeException(e);
                        }
                    } else {
                        found = value;
                    }


                    m.put(v.getKey(), found);
                },
                HashMap::putAll
            );

        copy.putAll(copyMap);

        return copy;
    }
@SuppressWarnings("unchecked")
    @Test
    void merge() {
        Map<String, Object> a = Map.of(
            "map", Map.of(
                "map_a", "a",
                "map_b", "b",
                "map_c", "c"
            ),
            "string", "a",
            "int", 1,
            "lists", Collections.singletonList(1)
        );

        Map<String, Object> b = Map.of(
            "map", Map.of(
                "map_c", "e",
                "map_d", "d"
            ),
            "string", "b",
            "float", 1F,
            "lists", Collections.singletonList(2)
        );

        Map<String, Object> merge = MapUtils.merge(a, b);

        assertThat(((Map<String, Object>) merge.get("map")).size(), is(4));
        assertThat(((Map<String, Object>) merge.get("map")).get("map_c"), is("e"));
        assertThat(merge.get("string"), is("b"));
        assertThat(merge.get("int"), is(1));
        assertThat(merge.get("float"), is(1F));
        assertThat((List<?>) merge.get("lists"), hasSize(2));
    }