<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: com.esri.arcgisruntime.internal.util.UnmodifiableListImpl breaks the java.util.List contract in Java Maps SDK Questions</title>
    <link>https://community.esri.com/t5/java-maps-sdk-questions/com-esri-arcgisruntime-internal-util/m-p/1078254#M2411</link>
    <description>&lt;P&gt;My first post above didn't really spell it out clearly enough.&lt;/P&gt;&lt;P&gt;The following code fails (sometimes) inside the if block&lt;/P&gt;&lt;LI-CODE lang="java"&gt;var iterator = featureCollectionLayer.getLayers().iterator();
if (iterator.hasNext()) {
  iterator.next(); // &amp;lt;-- IndexOutOfBoundsException here
}&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 13 Jul 2021 14:46:37 GMT</pubDate>
    <dc:creator>DaveWhitla</dc:creator>
    <dc:date>2021-07-13T14:46:37Z</dc:date>
    <item>
      <title>com.esri.arcgisruntime.internal.util.UnmodifiableListImpl breaks the java.util.List contract</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/com-esri-arcgisruntime-internal-util/m-p/1078179#M2405</link>
      <description>&lt;P&gt;Given the following (which attempts to provide enough context without irrelevant detail) ...&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;var featureCollection = new FeatureCollection();&lt;BR /&gt;var table &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;&lt;SPAN&gt;FeatureCollectionTable&lt;/SPAN&gt;(&lt;SPAN&gt;getFields&lt;/SPAN&gt;(), &lt;SPAN&gt;getGeometryType&lt;/SPAN&gt;(), &lt;SPAN&gt;getSpatialReference&lt;/SPAN&gt;());&lt;BR /&gt;&lt;SPAN&gt;var featureCollectionLayer &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;&lt;SPAN&gt;FeatureCollectionLayer&lt;/SPAN&gt;(&lt;SPAN&gt;featureCollection&lt;/SPAN&gt;);&lt;BR /&gt;&lt;SPAN&gt;featureCollection&lt;/SPAN&gt;.&lt;SPAN&gt;getTables&lt;/SPAN&gt;().&lt;SPAN&gt;add&lt;/SPAN&gt;(&lt;SPAN&gt;table&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;P&gt;A little later in execution ...&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;featureCollectionLayer.getLayers&lt;/SPAN&gt;().size()&lt;/PRE&gt;&lt;P&gt;returns &lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;while&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;featureCollectionLayer.getLayers&lt;/SPAN&gt;().get(0)&lt;/PRE&gt;&lt;P&gt;throws &lt;STRONG&gt;NoSuchElementException("java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and even afterwards&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;featureCollectionLayer.getLayers&lt;/SPAN&gt;().&lt;SPAN&gt;listIterator&lt;/SPAN&gt;().&lt;SPAN&gt;hasNext&lt;/SPAN&gt;()&lt;/PRE&gt;&lt;P&gt;returns&amp;nbsp;&lt;STRONG&gt;true&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;while&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;featureCollectionLayer.getLayers&lt;/SPAN&gt;().&lt;SPAN&gt;listIterator&lt;/SPAN&gt;().&lt;SPAN&gt;next&lt;/SPAN&gt;()&lt;/PRE&gt;&lt;P&gt;throws &lt;STRONG&gt;NoSuchElementException("java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What gives?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 09:42:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/com-esri-arcgisruntime-internal-util/m-p/1078179#M2405</guid>
      <dc:creator>DaveWhitla</dc:creator>
      <dc:date>2021-07-13T09:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: com.esri.arcgisruntime.internal.util.UnmodifiableListImpl breaks the java.util.List contract</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/com-esri-arcgisruntime-internal-util/m-p/1078254#M2411</link>
      <description>&lt;P&gt;My first post above didn't really spell it out clearly enough.&lt;/P&gt;&lt;P&gt;The following code fails (sometimes) inside the if block&lt;/P&gt;&lt;LI-CODE lang="java"&gt;var iterator = featureCollectionLayer.getLayers().iterator();
if (iterator.hasNext()) {
  iterator.next(); // &amp;lt;-- IndexOutOfBoundsException here
}&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 13 Jul 2021 14:46:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/com-esri-arcgisruntime-internal-util/m-p/1078254#M2411</guid>
      <dc:creator>DaveWhitla</dc:creator>
      <dc:date>2021-07-13T14:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: com.esri.arcgisruntime.internal.util.UnmodifiableListImpl breaks the java.util.List contract</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/com-esri-arcgisruntime-internal-util/m-p/1078277#M2412</link>
      <description>&lt;P&gt;The cause would appear to be that &lt;FONT face="andale mono,times"&gt;size()&lt;/FONT&gt; returns &lt;FONT face="andale mono,times"&gt;(int)this.mCoreArray.getSize()&lt;/FONT&gt;&amp;nbsp;while &lt;FONT face="andale mono,times"&gt;get(int)&lt;/FONT&gt; indexes &lt;FONT face="andale mono,times"&gt;this.mElementCache&lt;/FONT&gt;, which at the time has size == 0 because &lt;FONT face="andale mono,times"&gt;mCoreArray&lt;/FONT&gt; was empty when the &lt;FONT face="andale mono,times"&gt;UnmodifiableListImpl&lt;/FONT&gt; was constructed.&lt;/P&gt;&lt;P&gt;While &lt;FONT face="andale mono,times"&gt;UnmodifiableListImpl&lt;/FONT&gt; is an unmodifiable wrapper, the &lt;FONT face="andale mono,times"&gt;CoreArray&lt;/FONT&gt; it adapts is evidently mutable. Nothing wrong with that - its just that the assumption encoded in &lt;FONT face="andale mono,times"&gt;get(int)&lt;/FONT&gt; is invalid.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DaveWhitla_0-1626189461810.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/18308i5DDF8B374477EDFF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DaveWhitla_0-1626189461810.png" alt="DaveWhitla_0-1626189461810.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DaveWhitla_0-1626188715649.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/18307i12C83A63E00AF379/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DaveWhitla_0-1626188715649.png" alt="DaveWhitla_0-1626188715649.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 15:20:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/com-esri-arcgisruntime-internal-util/m-p/1078277#M2412</guid>
      <dc:creator>DaveWhitla</dc:creator>
      <dc:date>2021-07-13T15:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: com.esri.arcgisruntime.internal.util.UnmodifiableListImpl breaks the java.util.List contract</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/com-esri-arcgisruntime-internal-util/m-p/1079988#M2415</link>
      <description>&lt;P&gt;Where can I log a bug?&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jul 2021 03:07:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/com-esri-arcgisruntime-internal-util/m-p/1079988#M2415</guid>
      <dc:creator>DaveWhitla</dc:creator>
      <dc:date>2021-07-17T03:07:39Z</dc:date>
    </item>
  </channel>
</rss>

