title: List filled with last data instead of respecting insert order (Android)
body: <p>I have an XML parser that looks like this:</p>
  
  <pre><code>public class XMLParser {
  
  public static void XMLParser(){
  
  }
  
  public List&lt;itemRSS&gt; parse(InputStream inputStream) throws XmlPullParserException,
          IOException {
      String title = null;
      String link = null;
      String description = null;
      boolean isItem = false;
      List&lt;itemRSS&gt; items = new ArrayList&lt;&gt;();
  
      try {
          XmlPullParser xmlPullParser = Xml.newPullParser();
          xmlPullParser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
          xmlPullParser.setInput(inputStream, null);
  
          xmlPullParser.nextTag();
          while (xmlPullParser.next() != XmlPullParser.END_DOCUMENT) {
              int eventType = xmlPullParser.getEventType();
  
              String name = xmlPullParser.getName();
              if(name == null)
                  continue;
  
              if(eventType == XmlPullParser.END_TAG) {
                  if(name.equalsIgnoreCase("item")) {
                      isItem = false;
                  }
                  continue;
              }
  
              if (eventType == XmlPullParser.START_TAG) {
                  if(name.equalsIgnoreCase("item")) {
                      isItem = true;
                      continue;
                  }
              }
  
              Log.d("MyXmlParser", "Parsing name ==&gt; " + name);
              String result = "";
              if (xmlPullParser.next() == XmlPullParser.TEXT) {
                  result = xmlPullParser.getText();
                  xmlPullParser.nextTag();
              }
  
              if (name.equalsIgnoreCase("title")) {
                  title = result;
              } else if (name.equalsIgnoreCase("link")) {
                  link = result;
              } else if (name.equalsIgnoreCase("description")) {
                  description = result;
              }
  
              if (title != null &amp;&amp; link != null &amp;&amp; description != null) {
                  if(isItem) {
                      itemRSS item = new itemRSS(title, description, link);
                      items.add(item); 
                  }
                  else {
                      System.out.println("leo: " + title);
                      //mFeedTitle = title;
                      //mFeedLink = link;
                     // mFeedDescription = description;
                  }
  
                  title = null;
                  link = null;
                  description = null;
                  isItem = false;
              }
          }
  
          return items;
      } finally {
          inputStream.close();
      }
  }
  
  }
  </code></pre>
  
  <p>This is my condition in the code which is not working properly</p>
  
  <pre><code>if (title != null &amp;&amp; link != null &amp;&amp; description != null) {
                  if(isItem) {
                      itemRSS item = new itemRSS(title, description, link);
                      items.add(item); 
                  }
  </code></pre>
  
  <p>Basically, Instead of adding to the list in the order {1,2,3,4}, it just looks like {4,4,4,4} when the execution finishes.</p>
  
  <p>How can this happen? My intention is to do a simple RSS feed reader, so this parser is how I get the data from the feed to an Array, and then I set the Array as the adapter for a recycledView. Works fine so far, but it just writes a long list of the last title added instead of the correct order. </p>
  
  <p>I tracked the error to the code above, I'm pretty sure that's the problem but I don't know how to resolve this issue.</p>
  
  <p>Thanks in advance.</p>