Retrofit - send dynamic queries with same key

Viewed 2592

This is my interface:

 public interface ServerCalls{
        @GET
        Call<List<Integer>> searchNames(@Url String url, @QueryMap Map<String, 
        String> options);
    }
 }

and this is my call:

    APIs.LoadDataService service = 
        retrofit.create(APIs.LoadDataService.class);
        Map<String, String> parameters = new HashMap<>();
        parameters.put("name","yoni");
        parameters.put("name","albert");
        parameters.put("q","text");
        Call<List<Integer>> call = service.searchNames(APIs.GET_NAMES, parameters);

to make a call with dynamic queries i need to used @QueryMap so is mean i need to work with some Map. my problem is when i need to send the same key because Map get always the last value from key and not supported duplicate.

my api need to get something like that:

myapi.com/getLastName?name=yoni&name=albert

how can i do it? (without guava library)

2 Answers
Related