public static void buildList(Map<String,Object> nd,List<Map<String,Object>> lst,int depth){
  String id=(String)nd.get("id");
  String nm=(String)nd.get("name");
  String spc="";
  for (int i=0; i < depth; i++)   spc+="&nbsp;&nbsp;";
  Map<String,Object> map=FastMap.newInstance();
  map.put("dataCategoryId",id);
  map.put("categoryName",spc + nm);
  if (id != null && !id.equals("ROOT") && !id.equals("")) {
    lst.add(map);
  }
  List<Map<String,Object>> kids=UtilGenerics.checkList(nd.get("kids"));
  for (  Map<String,Object> kidNode : kids) {
    buildList(kidNode,lst,depth + 1);
  }
}

public static void buildList ( Map < String , Object > nd , List < Map < String , Object > > lst , int depth ) { String id = ( String ) nd . get ( "id" ) ; String nm = ( String ) nd . get ( "name" ) ; String spc = "" ; for ( int i = 0 ; i < depth ; i ++ ) spc += "&nbsp;&nbsp;" ; Map < String , Object > map = FastMap . newInstance ( ) ; map . put ( "dataCategoryId" , id ) ; map . put ( "categoryName" , spc + nm ) ; if ( id != null && ! id . equals ( "ROOT" ) && ! id . equals ( "" ) ) { lst . add ( map ) ; } List < Map < String , Object > > kids = UtilGenerics . checkList ( nd . get ( "kids" ) ) ; for ( Map < String , Object > kidNode : kids ) { buildList ( kidNode , lst , depth + 1 ) ; } }
takes a datacategory structure and builds a list of maps , one value ( id ) is the datacategoryid value and the other is an indented string suitable for use in a drop - down pick list .
