title: How to count data in Java
body: <p>I try count data and remove Duplicate data by the following code ,but I got an error message with this code.</p>
  
  <p>Can anyone help me?</p>
  
  <p><strong>StructorRecords.java</strong> </p>
  
  <pre><code>public class StructorRecords {
  
  public String recorusername;
  public String id;
  public String full_name;
  public String recordimg;
  public Integer count;}
  </code></pre>
  
  <p><strong>counter.java</strong></p>
  
  <pre><code>public static void orderbylike(StructorRecords data) {
      if (G.bollike) {
          G.savelike.add(data);
      } else {
          Iterator itr = G.savelike.iterator();
          int i = 1;
          while (itr.hasNext()) {
              StructorRecords SR = (StructorRecords) itr.next();
              if (SR.id.equals(data.id)) {
                  data.count = SR.count + 1;
                  G.savelike.set(i, data);
              } else {
                  G.savelike.add(data);
              }
              i++;
          }
  
      }
  }
  </code></pre>
  
  <p>this is logs that get me 
  <strong>LOG</strong></p>
  
  <pre><code>02-01 17:19:23.142 7587-9416/sanjinsgr.limosoftwaregroup.ir.instasanj W/System.err: java.util.ConcurrentModificationException
  02-01 17:19:23.152 7587-9416/sanjinsgr.limosoftwaregroup.ir.instasanj W/System.err:     at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:569)
  02-01 17:19:23.152 7587-9416/sanjinsgr.limosoftwaregroup.ir.instasanj W/System.err:     at sanjinsgr.limosoftwaregroup.ir.instasanj.counter.orderbylike(counter.java:21)
  02-01 17:19:23.152 7587-9416/sanjinsgr.limosoftwaregroup.ir.instasanj W/System.err:     at sanjinsgr.limosoftwaregroup.ir.instasanj.loginActivity$11.run(loginActivity.java:460)
  02-01 17:19:23.162 7587-9416/sanjinsgr.limosoftwaregroup.ir.instasanj W/System.err:     at java.lang.Thread.run(Thread.java:856)
  02-01 17:19:23.451 7587-9472/sanjinsgr.limosoftwaregroup.ir.instasanj W/System.err: java.util.ConcurrentModificationException
  02-01 17:19:23.451 7587-9472/sanjinsgr.limosoftwaregroup.ir.instasanj W/System.err:     at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:569)
  02-01 17:19:23.451 7587-9472/sanjinsgr.limosoftwaregroup.ir.instasanj W/System.err:     at sanjinsgr.limosoftwaregroup.ir.instasanj.counter.orderbylike(counter.java:21)
  02-01 17:19:23.461 7587-9472/sanjinsgr.limosoftwaregroup.ir.instasanj W/System.err:     at sanjinsgr.limosoftwaregroup.ir.instasanj.loginActivity$11.run(loginActivity.java:460)
  02-01 17:19:23.461 7587-9472/sanjinsgr.limosoftwaregroup.ir.instasanj W/System.err:     at java.lang.Thread.run(Thread.java:856)
  02-01 17:19:23.583 7587-9417/sanjinsgr.limosoftwaregroup.ir.instasanj W/System.err: java.util.ConcurrentModificationException
  02-01 17:19:23.583 7587-9417/sanjinsgr.limosoftwaregroup.ir.instasanj W/System.err:     at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:569)
  02-01 17:19:23.583 7587-9417/sanjinsgr.limosoftwaregroup.ir.instasanj W/System.err:     at sanjinsgr.limosoftwaregroup.ir.instasanj.counter.orderbylike(counter.java:21)
  02-01 17:19:23.583 7587-9417/sanjinsgr.limosoftwaregroup.ir.instasanj W/System.err:     at sanjinsgr.limosoftwaregroup.ir.instasanj.loginActivity$11.run(loginActivity.java:460)
  02-01 17:19:23.592 7587-9417/sanjinsgr.limosoftwaregroup.ir.instasanj W/System.err:     at java.lang.Thread.run(Thread.java:856)
  </code></pre>