private Map < String , String > convertToMap ( Object expression ) { if ( expression instanceof Map ) { return ( Map < String , String > ) expression ; } return Stream . of ( Optional . ofNullable ( expression ) . map ( Object :: toString ) . orElse ( "" ) . split ( "," ) ) . map ( keyValue -> Optional . ofNullable ( StringUtils . split ( keyValue , "=" ) ) . orElse ( new String [ ] { keyValue , "" } ) ) . collect ( Collectors . toMap ( keyValue -> keyValue [ 0 ] , keyValue -> keyValue [ 1 ] ) ) ; }
Convert query string key - value expression to map .