title: how to make count similar id object in list and display in recyclerview?
body: <p>I have a JSON array, in that I need to make match count using ParentCommentID and parse data into recyclerview using text view while  counting  i get number count only one position and same for other item also, any help.</p>
  
  <pre><code>{
    "d": {
      "results": [
        {
          "__metadata": {
            "id": "e7433825-6771-4f5e-96c7-c4d2674d7764",
            "uri": "",
            "etag": "\"2\"",
            "type": "SP.Data.InquiryDiscussionsListListItem"
          },
          "Author": {
            "__metadata": {
              "id": "f064775c-6161-4bdb-9f4d-8bc6a898d218",
              "type": "SP.Data.UserInfoItem"
            },
            "Title": "Submitter1"
          },
          "Id": 1501,
          "ID": 1501,
          "Title": null,
          "Created": "2019-06-06T04:15:17Z",
          "ParentCommentID": "1439",
          "Comment": "&lt;div class=\"ExternalClass8C333A77B6564A53BED74CA1BA2D2A10\"&gt;
          reply add for 009&lt;/div&gt;",
          "CommentType": null,
          "CommentDocumentName": null,
          "AppID": "1083",
          "Role": "Customer"
        },
        {
          "__metadata": {
            "id": "e92f708f-93dc-4587-8c4f-5518ed24f360",
            "uri": "",
            "etag": "\"2\"",
            "type": "SP.Data.InquiryDiscussionsListListItem"
          },
          "Author": {
            "__metadata": {
              "id": "209d2d9a-bb07-4064-aaa0-231ad881a80f",
              "type": "SP.Data.UserInfoItem"
            },
            "Title": "Submitter1"
          },
          "Id": 1500,
          "ID": 1500,
          "Title": null,
          "Created": "2019-06-06T04:14:55Z",
          "ParentCommentID": "1439",
          "Comment": "&lt;div class=\"ExternalClass44B1A0BB4D314C57BEE20141BFF10491\"&gt;comment add for       009&lt;/div&gt;",
          "CommentType": null,
          "CommentDocumentName": null,
          "AppID": "1083",
          "Role": "Customer"
        },
        {
          "__metadata": {
            "id": "ec112002-3132-4bc1-8f85-03fbd9fda11d",
            "uri": "",
            "etag": "\"2\"",
            "type": "SP.Data.InquiryDiscussionsListListItem"
          },
          "Author": {
            "__metadata": {
              "id": "6e8ecb1d-4deb-4168-a8b4-a725abf8002a",
              "type": "SP.Data.UserInfoItem"
            },
            "Title": "Sarada Devi Potti"
          },
          "Id": 1439,
          "ID": 1439,
          "Title": "Canceled",
          "Created": "2019-06-03T09:32:34Z",
          "ParentCommentID": null,
          "Comment": "&lt;div  class=\"ExternalClass5E1BFEDC348C43719AD940E644E0E0B6\"&gt;sdaeadfasdf&lt;/div&gt;",
          "CommentType": "Public",
          "CommentDocumentName": null,
          "AppID": "1083",
          "Role": "Budget Analyst"
        }
      ]
    }
  }
  </code></pre>
  
  <p>My code is onbind method:</p>
  
  <pre><code> Map&lt;String, Integer&gt; commentsCountMap = new HashMap&lt;&gt;();
      for(Result res : discussionsList) {
          String parentCommentId = res.getParentCommentID();
          // If the MyDocsResult has a parent comment
          if(parentCommentId != null) {
              // get the count for this parent comment (default to 0)
              int nbCommentsForParent = commentsCountMap.getOrDefault(parentCommentId, 0);
              // increment the count
              nbCommentsForParent++;
              // Update the Map with the new count
              commentsCountMap.put(parentCommentId, nbCommentsForParent);
              System.out.println(commentsCountMap);
              Log.d("Count:",commentsCountMap.toString());
  
  
          }
      }
  </code></pre>
  
  <p>for example id <code>1439</code>, having two <code>ParentCommentID</code>, so in that case for id <code>1439</code> there should be a count of two comments, I tried to use for in my 
   recyclerview adapter but its dose not work.</p>