public static PyExpr convertMapToOrderedDict ( Map < PyExpr , PyExpr > dict ) { List < String > values = new ArrayList <> ( ) ; for ( Map . Entry < PyExpr , PyExpr > entry : dict . entrySet ( ) ) { values . add ( "(" + entry . getKey ( ) . getText ( ) + ", " + entry . getValue ( ) . getText ( ) + ")" ) ; } Joiner joiner = Joiner . on ( ", " ) ; return new PyExpr ( "collections.OrderedDict([" + joiner . join ( values ) + "])" , Integer . MAX_VALUE ) ; }
Convert a java Map to valid PyExpr as dict .