/** * Recursively decompose namespaces * @param namespace * @return the decomposed list collection */ private static List<String> recursion(String namespace) { int index = namespace.indexOf("." ); List<String> arr= new ArrayList<>(); if(index!=-1) { String currentName= namespace.substring(0, index); arr.add(currentName); String nextNamespace= namespace.substring(currentName.length()+1); arr.addAll(recursion(nextNamespace)); }else { arr.add(namespace); } return arr; }
recursion("aa.bb.cc");