@ SuppressWarnings ( "unchecked" ) private static Object canonicalize ( final Object from ) { if ( from instanceof BSONObject && ! ( from instanceof BasicBSONList ) ) { return canonicalizeBSONObject ( ( BSONObject ) from ) ; } else if ( from instanceof List ) { return canonicalizeList ( ( List < Object > ) from ) ; } else if ( from instanceof Map ) { return canonicalizeMap ( ( Map < String , Object > ) from ) ; } else { return from ; } }
create a copy of from but with keys ordered alphabetically