class PropertiesExt {

    public static Map<String, Map<String, String>> groupByRootName(Map<String, String> properties, int rootParts) {
        if (CollectionsExt.isNullOrEmpty(properties)) {
            return Collections.emptyMap();
        }
        Map<String, Map<String, String>> result = new HashMap<>();
        for (Map.Entry<String, String> entry : properties.entrySet()) {
            Pair<String, String> parts = split(entry.getKey(), rootParts);
            if (parts == null) {
                continue;
            }
            String rootPart = parts.getLeft();
            String internalName = parts.getRight();

            Map<String, String> internalProps = result.get(rootPart);
            if (internalProps == null) {
                result.put(rootPart, internalProps = new HashMap<>());
            }
            internalProps.put(internalName, entry.getValue());
        }
        return result;
    }

    private  PropertiesExt();

}