public static List transpose(List lists) {
        List result = new ArrayList();
        if (lists.isEmpty()) return result;
        int minSize = Integer.MAX_VALUE;
        for (Object listLike : lists) {
            List list = (List) DefaultTypeTransformation.castToType(listLike, List.class);
            if (list.size() < minSize) minSize = list.size();
        }
        if (minSize == 0) return result;
        for (int i = 0; i < minSize; i++) {
            result.add(new ArrayList());
        }
        for (Object listLike : lists) {
            List list = (List) DefaultTypeTransformation.castToType(listLike, List.class);
            for (int i = 0; i < minSize; i++) {
                List resultList = (List) result.get(i);
                resultList.add(list.get(i));
            }
        }
        return result;
    }
public static List transpose ( List lists ) { List result = new ArrayList ( ) ; if ( lists . isEmpty ( ) ) return result ; int minSize = Integer . MAX_VALUE ; for ( Object listLike : lists ) { List list = ( List ) DefaultTypeTransformation . castToType ( listLike , List . class ) ; if ( list . size ( ) < minSize ) minSize = list . size ( ) ; } if ( minSize == 0 ) return result ; for ( int i = 0 ; i < minSize ; i ++ ) { result . add ( new ArrayList ( ) ) ; } for ( Object listLike : lists ) { List list = ( List ) DefaultTypeTransformation . castToType ( listLike , List . class ) ; for ( int i = 0 ; i < minSize ; i ++ ) { List resultList = ( List ) result . get ( i ) ; resultList . add ( list . get ( i ) ) ; } } return result ; }
Transposes the given lists.
So, <code>transpose([['a', 'b'], [1, 2]])</code>
is <code>[['a', 1], ['b', 2]]</code> and
<code>transpose([['a', 'b', 'c']])</code>
is <code>[['a'], ['b'], ['c']]</code>.

@param lists the given lists
@return a List of the transposed lists