algoliasearch/src/main/java/com/algolia/search/saas/AbstractQuery.java
static @NonNull String build(@NonNull Map<String, String> parameters) {
        StringBuilder stringBuilder = new StringBuilder();
        try {
            for (Map.Entry<String, String> entry : parameters.entrySet()) {
                String key = entry.getKey();
                if (stringBuilder.length() > 0)
                    stringBuilder.append('&');
                stringBuilder.append(urlEncode(key));
                String value = entry.getValue();
                if (value != null) {
                    stringBuilder.append('=');
                    stringBuilder.append(urlEncode(value));
                }
            }
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e); // should never happen: UTF-8 is always supported
        }
        return stringBuilder.toString();
    }
static @NonNull String build(@NonNull Map<String, String> parameters) {
        StringBuilder stringBuilder = new StringBuilder();
        try {
            for (Map.Entry<String, String> entry : parameters.entrySet()) {
                String key = entry.getKey();
                if (stringBuilder.length() > 0)
                    stringBuilder.append('&');
                stringBuilder.append(urlEncode(key));
                String value = entry.getValue();
                if (value != null) {
                    stringBuilder.append('=');
                    stringBuilder.append(urlEncode(value));
                }
            }
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e); // should never happen: UTF-8 is always supported
        }
        return stringBuilder.toString();
    }
static @ NonNull String build ( @ NonNull Map < String , String > parameters ) { StringBuilder stringBuilder = new StringBuilder ( ) ; try { for ( Map . Entry < String , String > entry : parameters . entrySet ( ) ) { String key = entry . getKey ( ) ; if ( stringBuilder . length ( ) > 0 ) stringBuilder . append ( ' ' ) ; stringBuilder . append ( urlEncode ( key ) ) ; String value = entry . getValue ( ) ; if ( value != null ) { stringBuilder . append ( ' ' ) ; stringBuilder . append ( urlEncode ( value ) ) ; } } } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; // should never happen: UTF-8 is always supported } return stringBuilder . toString ( ) ; }
Build a query string from a map of URL parameters.
@return A string suitable for use inside the query part of a URL (i.e. after the question mark).
Build a query string from a map of URL parameters .