src/org/nutz/mapl/impl/MaplRebuild.java
@SuppressWarnings("unchecked")
    private void injectList(List<Object> list, int keyIndex, int[] eleIndexes) {
        // 下标列表如果是多个，那么预先处理一下列表
        int i_last = eleIndexes.length - 1;
        for (int i = 0; i < i_last; i++) {
            int index = eleIndexes[i];
            Object ele = list.get(index);
            // 是列表？嗯很好很好
            if (ele instanceof List) {
                list = (List<Object>) ele;
            }
            // 不是列表啊，不能忍
            else {
                throw Lang.makeThrow("invalid keyPath '%s' in key:%d eleIndex:%d",
                                     Strings.join(".", keys),
                                     keyIndex,
                                     i);
            }
        }

        // 得到要处理的下标
        int eleIndex = eleIndexes[i_last];

        // 添加模式
        if (model == Model.add) {
            if (keyIndex == keys.length - 1) {
                if (val instanceof Collection) {
                    list.addAll((Collection<? extends Object>) val);
                } else {
                    list.add(eleIndex, val);
                }
                return;
            }
            if (list.size() <= eleIndex) {
                list.add(eleIndex, new LinkedHashMap<String, Object>());
            }
        } else if (model == Model.del) {
            if (keyIndex == keys.length - 1) {
                if (list.size() > eleIndex) {
                    list.remove(eleIndex);
                }
                return;
            }
            if (list.size() <= eleIndex) {
                return;
            }
        } else if (model == Model.cell) {
            if (keyIndex == keys.length - 1) {
                if (list.size() > eleIndex) {
                    cellObj = list.get(eleIndex);
                }
                return;
            }
            if (list.size() <= eleIndex) {
                return;
            }
        }
        inject((Map<String, Object>) list.get(eleIndex), keyIndex + 1);
    }
@SuppressWarnings("unchecked")
    private void injectList(List<Object> list, int keyIndex, int[] eleIndexes) {
        // 下标列表如果是多个，那么预先处理一下列表
        int i_last = eleIndexes.length - 1;
        for (int i = 0; i < i_last; i++) {
            int index = eleIndexes[i];
            Object ele = list.get(index);
            // 是列表？嗯很好很好
            if (ele instanceof List) {
                list = (List<Object>) ele;
            }
            // 不是列表啊，不能忍
            else {
                throw Lang.makeThrow("invalid keyPath '%s' in key:%d eleIndex:%d",
                                     Strings.join(".", keys),
                                     keyIndex,
                                     i);
            }
        }

        // 得到要处理的下标
        int eleIndex = eleIndexes[i_last];

        // 添加模式
        if (model == Model.add) {
            if (keyIndex == keys.length - 1) {
                if (val instanceof Collection) {
                    list.addAll((Collection<? extends Object>) val);
                } else {
                    list.add(eleIndex, val);
                }
                return;
            }
            if (list.size() <= eleIndex) {
                list.add(eleIndex, new LinkedHashMap<String, Object>());
            }
        } else if (model == Model.del) {
            if (keyIndex == keys.length - 1) {
                if (list.size() > eleIndex) {
                    list.remove(eleIndex);
                }
                return;
            }
            if (list.size() <= eleIndex) {
                return;
            }
        } else if (model == Model.cell) {
            if (keyIndex == keys.length - 1) {
                if (list.size() > eleIndex) {
                    cellObj = list.get(eleIndex);
                }
                return;
            }
            if (list.size() <= eleIndex) {
                return;
            }
        }
        inject((Map<String, Object>) list.get(eleIndex), keyIndex + 1);
    }
@ SuppressWarnings ( "unchecked" ) private void injectList ( List < Object > list , int keyIndex , int [ ] eleIndexes ) { // 下标列表如果是多个，那么预先处理一下列表 int i_last = eleIndexes . length - 1 ; for ( int i = 0 ; i < i_last ; i ++ ) { int index = eleIndexes [ i ] ; Object ele = list . get ( index ) ; // 是列表？嗯很好很好 if ( ele instanceof List ) { list = ( List < Object > ) ele ; } // 不是列表啊，不能忍 else { throw Lang . makeThrow ( "invalid keyPath '%s' in key:%d eleIndex:%d" , Strings . join ( "." , keys ) , keyIndex , i ) ; } } // 得到要处理的下标 int eleIndex = eleIndexes [ i_last ] ; // 添加模式 if ( model == Model . add ) { if ( keyIndex == keys . length - 1 ) { if ( val instanceof Collection ) { list . addAll ( ( Collection < ? extends Object > ) val ) ; } else { list . add ( eleIndex , val ) ; } return ; } if ( list . size ( ) <= eleIndex ) { list . add ( eleIndex , new LinkedHashMap < String , Object > ( ) ) ; } } else if ( model == Model . del ) { if ( keyIndex == keys . length - 1 ) { if ( list . size ( ) > eleIndex ) { list . remove ( eleIndex ) ; } return ; } if ( list . size ( ) <= eleIndex ) { return ; } } else if ( model == Model . cell ) { if ( keyIndex == keys . length - 1 ) { if ( list . size ( ) > eleIndex ) { cellObj = list . get ( eleIndex ) ; } return ; } if ( list . size ( ) <= eleIndex ) { return ; } } inject ( ( Map < String , Object > ) list . get ( eleIndex ) , keyIndex + 1 ) ; }
注入List

@param list
列表
@param keyIndex
当前 Key 路径的列表
@param eleIndexes
注入的元素下标列表
注入List