{"id":486,"date":"2014-05-29T04:59:53","date_gmt":"2014-05-29T04:59:53","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=486"},"modified":"2014-05-29T05:16:15","modified_gmt":"2014-05-29T05:16:15","slug":"difference-between-modcount-and-size-arraylist","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/difference-between-modcount-and-size-arraylist\/","title":{"rendered":"Difference between modcount and size ArrayList"},"content":{"rendered":"<p>modcount of the list lets you know if there has been a structural modification made that might cause the current operation to give incorrect results.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n  List&lt;String&gt; arrNames = new ArrayList&lt;String&gt;();\r\n  arrNames.add(&quot;Mugil&quot;);\r\n  arrNames.add(&quot;Vinu&quot;);\r\n  arrNames.add(&quot;Bala&quot;);\r\n  arrNames.add(&quot;Madhu&quot;);\t\t\r\n  arrNames.remove(0);\t\t\r\n  arrNames.add(&quot;Swathi&quot;);\t\t\r\n  arrNames.remove(1);\r\n<\/pre>\n<p>When the control reaches<br \/>\nLine 6  The Size and Modcount of the arrNames would be 4<br \/>\nLine 7  The Size and Modcount would be 5 and size would be 3<br \/>\nLine 7  The Size and Modcount would be 6 and size would be 4<\/p>\n<p>Fine the Screenshots below for further Details<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/codethataint.com\/blog\/wp-content\/uploads\/2014\/05\/ModCount1.png\" width=\"607\" height=\"312\" class=\"alignnone\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/codethataint.com\/blog\/wp-content\/uploads\/2014\/05\/ModCount2.png\" width=\"607\" height=\"312\" class=\"alignnone\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/codethataint.com\/blog\/wp-content\/uploads\/2014\/05\/ModCount3.png\" width=\"607\" height=\"312\" class=\"alignnone\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>modcount of the list lets you know if there has been a structural modification made that might cause the current operation to give incorrect results. List&lt;String&gt; arrNames = new ArrayList&lt;String&gt;(); arrNames.add(&quot;Mugil&quot;); arrNames.add(&quot;Vinu&quot;); arrNames.add(&quot;Bala&quot;); arrNames.add(&quot;Madhu&quot;); arrNames.remove(0); arrNames.add(&quot;Swathi&quot;); arrNames.remove(1); When the control reaches Line 6 The Size and Modcount of the arrNames would be 4 Line 7&hellip; <a href=\"https:\/\/codethataint.com\/blog\/difference-between-modcount-and-size-arraylist\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"class_list":["post-486","post","type-post","status-publish","format-standard","hentry","category-list"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/486","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=486"}],"version-history":[{"count":4,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/486\/revisions"}],"predecessor-version":[{"id":493,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/486\/revisions\/493"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}