How to synchronize the Arraylist to the Retrofit result

228 Views Asked by At

This is one of the APIs that working with Retrofit library.

 @GET("users/self/media/recent/")
        Call<List<Media>> getRecentPostList(@Query("access_token") String access_token);

I'm using GsonConverterFactory to output the result, and this will return a List<> object, but can I synchronize the List?

What I'm trying is to use Collections.synchronizedList(new ArrayList<>()), and pass the result list of Gson as a parameter to the constructor of the ArrayList.

Is there any better way?

0

There are 0 best solutions below