public static List<WayDataBlock> encode(List<WayDataBlock> blocks, Encoding encoding) {
        if (blocks == null) {
            return null;
        }

        if (encoding == Encoding.NONE) {
            return blocks;
        }

        List<WayDataBlock> results = new ArrayList<>();

        for (WayDataBlock wayDataBlock : blocks) {
            List<Integer> outer = mEncode(wayDataBlock.getOuterWay(), encoding);
            List<List<Integer>> inner = null;
            if (wayDataBlock.getInnerWays() != null) {
                inner = new ArrayList<>();
                for (List<Integer> list : wayDataBlock.getInnerWays()) {
                    inner.add(mEncode(list, encoding));
                }
            }
            results.add(new WayDataBlock(outer, inner, encoding));
        }

        return results;
    }
public static List < WayDataBlock > encode ( List < WayDataBlock > blocks , Encoding encoding ) { if ( blocks == null ) { return null ; } if ( encoding == Encoding . NONE ) { return blocks ; } List < WayDataBlock > results = new ArrayList < > ( ) ; for ( WayDataBlock wayDataBlock : blocks ) { List < Integer > outer = mEncode ( wayDataBlock . getOuterWay ( ) , encoding ) ; List < List < Integer > > inner = null ; if ( wayDataBlock . getInnerWays ( ) != null ) { inner = new ArrayList < > ( ) ; for ( List < Integer > list : wayDataBlock . getInnerWays ( ) ) { inner . add ( mEncode ( list , encoding ) ) ; } } results . add ( new WayDataBlock ( outer , inner , encoding ) ) ; } return results ; }
Encodes a list of WayDataBlock objects with the given encoding scheme.

@param blocks   List of WayDataBlock objects to be encoded.
@param encoding The Encoding which is used.
@return A new list of new WayDataBlock objects encoded with the given encoding. The original list is returned in
case the encoding equals NONE.