title: Not able to return a list of objects from retrofit response
body: <p>I'm using retrofit library to do API calls for my app. I wrote a seperate function for the API so that it is re usable. The response I'm getting back is a list of the object 'Movies' . But im not able to return the object . What should I do here? </p>
  
  <p><strong>The function which gets the data from API</strong></p>
  
  <pre><code>   // These are the retrofit codes to get the data from TMDB API
      private List&lt;Movies&gt; getDataFromServer(int page)
  {
       ApiInterface apiService = ApiClient.getClient().create(ApiInterface.class);
  
      Call&lt;Response&gt; call = apiService.getPopularMovies(API_KEY , page);
  
      List&lt;Movies&gt; movies = new ArrayList&lt;&gt;();
  
      call.enqueue(new Callback&lt;Response&gt;() {
          @Override
          public void onResponse(Call&lt;Response&gt; call, retrofit2.Response&lt;Response&gt; response) {
              movies = response.body().getMovies();
          }
  
          @Override
          public void onFailure(Call&lt;Response&gt; call, Throwable t) {
              Log.e(TAG,t.toString());
              movies = null;
          }
      });
       return movies;
  
  }
  </code></pre>
  
  <p>It says that I should declare the movies as final but when I do , it automatically converts the array list into an array and the movies inside the onResponse and onFailure is turned into moviess[0]. I just want to get the movies , and then return it as a List</p>