@SuppressWarnings({ "rawtypes", "unchecked" })
    public Object get(){
        if(isLeaf()){
            return value == null ? null : value.length == 1 ? value[0] : value;
        }
        if(type == TYPE_LIST){
            // fix issue #1109, 列表的key需要重排
            List list = new ArrayList();
            List<Integer> keys = new ArrayList<Integer>();
            List<String> keys2 = new ArrayList<String>();
            
            for (String key : child.keySet()) {
                try {
                    keys.add(Integer.parseInt(key));
                }
                catch (NumberFormatException e) {
                    keys2.add(key);
                }
            }
            Collections.sort(keys);
            for(Integer index : keys){
                list.add(child.get(index.toString()).get());
            }
            for(String key2 : keys2){
                list.add(child.get(key2).get());
            }
            return list;
        }
        Map map = new HashMap();
        for(String o : child.keySet()){
            map.put(o, child.get(o).get());
        }
        return map;
    }
@SuppressWarnings({ "rawtypes", "unchecked" })
    public Object get(){
        if(isLeaf()){
            return value == null ? null : value.length == 1 ? value[0] : value;
        }
        if(type == TYPE_LIST){
            
            List list = new ArrayList();
            List<Integer> keys = new ArrayList<Integer>();
            List<String> keys2 = new ArrayList<String>();
            
            for (String key : child.keySet()) {
                try {
                    keys.add(Integer.parseInt(key));
                }
                catch (NumberFormatException e) {
                    keys2.add(key);
                }
            }
            Collections.sort(keys);
            for(Integer index : keys){
                list.add(child.get(index.toString()).get());
            }
            for(String key2 : keys2){
                list.add(child.get(key2).get());
            }
            return list;
        }
        Map map = new HashMap();
        for(String o : child.keySet()){
            map.put(o, child.get(o).get());
        }
        return map;
    }
@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) public Object get ( ) { if ( isLeaf ( ) ) { return value == null ? null : value . length == 1 ? value [ 0 ] : value ; } if ( type == TYPE_LIST ) { // fix issue #1109, 列表的key需要重排 List list = new ArrayList ( ) ; List < Integer > keys = new ArrayList < Integer > ( ) ; List < String > keys2 = new ArrayList < String > ( ) ; for ( String key : child . keySet ( ) ) { try { keys . add ( Integer . parseInt ( key ) ) ; } catch ( NumberFormatException e ) { keys2 . add ( key ) ; } } Collections . sort ( keys ) ; for ( Integer index : keys ) { list . add ( child . get ( index . toString ( ) ) . get ( ) ) ; } for ( String key2 : keys2 ) { list . add ( child . get ( key2 ) . get ( ) ) ; } return list ; } Map map = new HashMap ( ) ; for ( String o : child . keySet ( ) ) { map . put ( o , child . get ( o ) . get ( ) ) ; } return map ; }
提取出list,map结构
提取出list map结构