Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The following two lines are identical (to the compiler), this is true even if you have a class called <code>Value</code> as the named parameter will mask the class type</p> <pre><code>class RowList&lt;Value&gt; extends ArrayList&lt;List&lt;Value&gt;&gt; class RowList&lt;T&gt; extends ArrayList&lt;List&lt;T&gt;&gt; </code></pre> <p>The reason for this is because value inside the first <code>&lt;&gt;</code> is a named type parameter. So when you attempt to do something like</p> <pre><code>class RowList&lt;List&lt;Value&gt;&gt; extends ArrayList&lt;List&lt;Value&gt;&gt; </code></pre> <p>You have attempted to create a named type paramter <code>List&lt;Value&gt;</code> which (in Java) is an invalid identifier, but instead you will get an error something like <code>Syntax error on token(s), misplaced construct(s)</code></p> <p>I think instead you are really trying to write</p> <pre><code>public class RowList extends ArrayList&lt;Value&gt; { @Override public boolean add(Value e) { // TODO Custom code to check and what not return super.add(e); } } </code></pre> <p>Where <code>Value</code> is a custom object in your codebase. Then elsewhere in your code you can do:</p> <pre><code>RowList rl = new RowList(); rl.add(new Value(...)); Value v = rl.get(i); </code></pre> <p><strong>EDIT:</strong></p> <p>The previous example assumes that the <code>Value</code> class is an entry row of data. If instead it is a single item of data, and the row is represented by a <code>List</code> then it would be more like the following:</p> <pre><code>public class RowList extends ArrayList&lt;List&lt;Value&gt;&gt; { @Override public boolean add(List&lt;Value&gt; e) { // TODO Custom code to check and what not return super.add(e); } } RowList rl = new RowList(); List&lt;Value&gt; row = new ArrayList&lt;Value&gt;(); row.add(new Value(...)); rl.add(row); List&lt;Value&gt; rowGet = rl.get(i); </code></pre>
    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. 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