title: Android add pair item properly to ArrayList of type pair
body: <p>I have an <code>ArrayList&lt;Pair&lt;String, String&gt;&gt;</code> called "allsentences" and I'm having trouble adding pair items to it within a for loop. The pair contains string values from 2 other arrays (the grabbing of these values works properly). But I'm always having a result of something like <code>android.util.Pair@c5e38809</code> for each pair item in the list (I use Log.d to display the whole list and the items individually).</p>
  
  <p>My code:</p>
  
  <pre><code>//two other JSONarrays (sentences and usernames) back here
  
  ArrayList&lt;Pair&lt;String, String&gt;&gt; allsentences = new ArrayList&lt;Pair&lt;String, String&gt;&gt;();
  for (int f=0; f&lt;sentences.length(); f++){
      String sentence = sentences.getString(f);
      String username = usernames.getString(f);
  
      allsentences.add(Pair.create(sentence, username));
  }
  </code></pre>
  
  <p>What can I do to add a properly formatted pair to the ArrayList?</p>
  
  <p>I've also tried creating a pair item beforehand and adding that item to the arraylist as so:</p>
  
  <pre><code>ArrayList&lt;Pair&lt;String, String&gt;&gt; allsentences = new ArrayList&lt;Pair&lt;String, String&gt;&gt;();
  for (int f=0; f&lt;sentences.length(); f++){
      String sentence = sentences.getString(f);
      String username = usernames.getString(f);
  
      Pair&lt;String, String&gt; item = new Pair&lt;String, String&gt;(sentence, username);
  
      allsentences.add(item);
  }
  </code></pre>
  
  <p>Both options I have used Log to display the values of the pair items, and the all come out in the same strange format. It is also not the problem of the original strings inserted in the pairs, as I also displayed the value of that using log, and it came out as a proper string. (Sorry I might be completely missing some sort of syntax here but I'm very much new to Java/Android text or array formatting). </p>
  
  <p>EDIT:
  I'm using</p>
  
  <pre><code>Log.d("Firstitem" + Integer.toString(f), item.first);
  Log.d("Seconditem" + Integer.toString(f), item.second);
  Log.d("Actualpairitem", item.toString());
  </code></pre>
  
  <p>within the for loop of the second example I provided. Also after the for loop I am using <code>Log.d("allsentences", allsentences.toString());</code> to show the entire arraylist.</p>