title: multiple types of array list via one method
body: <p>How can I pass multiple types of array list via one method</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>List&lt;PostsModel&gt; Posts = new ArrayList&lt;&gt;();
  List&lt;FavoriteModel&gt; Favorite = new ArrayList&lt;&gt;();
  @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_posts);
          Posts = LoadArrayList("PostsList"); //Error here
          Favorite = LoadArrayList("FavoriteList"); //Error here
      }
  
  public List&lt;Object&gt; LoadArrayList(String key) {
      SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
      Gson gson = new Gson();
      String json = prefs.getString(key, null);
      Type type = new TypeToken&lt;List&lt;Object&gt;&gt;() {
      }.getType();
      return gson.fromJson(json, type);
  }
  </code></pre>
  
  <p>I have tried a lot but don't work</p>