title: Updating the record in a file using arrayList
body: <p>I have a list of users who are playing a game. They have some statistics, which I am storing in arrayList newList. Once the game exits, I am storing the arrayList value in a .dat file. Now thing is I will need to update a record of a user, if he already exists in my .dat file. I thought of using 3 arrayList over here.</p>
  
  <pre><code>1. ArrayList newList will get the records from the file.
  2. ArrayList oldList will then store the replica of newList.
  3. Game ends. Compare arrayList newList and oldList, and store the updated list in ArrayList users.
  4. Store the ArrayList users in a file.
  
  void compare()
      {
          Player obj1=null,obj2=null;
          int newSize = newList.size();   //stores the new records of the users.
          int oldSize = oldList.size();   //stores the old records of the users.
          for(int i=0;i&lt;oldSize;i++)
          {
              for(int j=0;j&lt;newSize;j++)
              {
                  obj1=newList.get(i);
                  obj2=oldList.get(j);
                  if(obj1==obj2)
                  {
                      users.add(obj1);
                  }
                  else
                  {
                      users.add(obj2);
                  }
              }
  
          }
      }
  
  //store the records of users in the filename.dat
  </code></pre>
  
  <p>Will this logic work?</p>