Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Maybe he was refering to XML-serialization used in Webservices ? Having used those a few years ago, I remember that a Webservice returning a <code>List</code> object was difficult to connect to (at least I could not figure it out, probably because of the inner structure of <code>ArrayList</code>s and <code>LinkedList</code>s), although this was trivially done when a native array was returned.</p> <p>To adress Reddy's comment, </p> <blockquote> <p>But in any case (array or ArrayList) will get converted to XML, right?</p> </blockquote> <p>Yes they will, but the XML-serialization basically translated in XML all the data contained in the serialized object. </p> <p><strong>For an array</strong>, that is a series of values. For instance, if you declare and serialize</p> <pre><code>int[] array = {42, 83}; </code></pre> <p>You will probably get an XML result looking like :</p> <pre><code> &lt;array&gt;42&lt;/array&gt; &lt;array&gt;83&lt;/array </code></pre> <p><strong>For an ArrayList</strong>, that is :</p> <ul> <li>an array (obviously), which may have a size bigger than the actual number of elements</li> <li>several other members such as integer indexes (<code>firstIndex</code> and <code>lastIndex</code>), counts, etc</li> </ul> <p>(you can find all that stuff in the <a href="http://www.docjar.com/html/api/java/util/ArrayList.java.html" rel="nofollow noreferrer">source for <code>ArrayList.java</code></a>)</p> <p>So all of those will get translated to XML, which makes it more difficult for the Webservice client to read the actual values : it has to read the index values, find the actual array, and read the values contained between the two indexes.</p> <p>The serialization of :</p> <pre><code>ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); list.add(42); list.add(83); </code></pre> <p>might end up looking like :</p> <pre><code>&lt;firstIndex&gt;0&lt;/firstIndex&gt; &lt;lastIndex&gt;2&lt;/lastIndex&gt; &lt;E&gt;42&lt;/E&gt; &lt;E&gt;83&lt;/E&gt; &lt;E&gt;0&lt;/E&gt; &lt;E&gt;0&lt;/E&gt; &lt;E&gt;0&lt;/E&gt; &lt;E&gt;0&lt;/E&gt; &lt;E&gt;0&lt;/E&gt; &lt;E&gt;0&lt;/E&gt; &lt;E&gt;0&lt;/E&gt; &lt;E&gt;0&lt;/E&gt; </code></pre> <p>So basically, when using XML-serialization in Webservices, you'd better use arrays (such as <code>int[]</code>) than collections (such as <code>ArrayList&lt;Integer&gt;</code>). For that you might find useful to convert Collections to arrays using <code>Collection#toArray()</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload