Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>&lt;T&gt;</code> is a <em>generic</em> and can usually be read as "of type T". It depends on the type to the left of the &lt;> what it actually means.</p> <p>I don't know what a <code>Pool</code> or <code>PoolFactory</code> is, but you also mention <code>ArrayList&lt;T&gt;</code>, which is a standard Java class, so I'll talk to that.</p> <p>Usually, you won't see "T" in there, you'll see another type. So if you see <code>ArrayList&lt;Integer&gt;</code> for example, that means "An <code>ArrayList</code> of <code>Integer</code>s." Many classes use generics to constrain the type of the elements in a container, for example. Another example is <code>HashMap&lt;String, Integer&gt;</code>, which means "a map with <code>String</code> keys and <code>Integer</code> values."</p> <p>Your Pool example is a bit different, because there you are <em>defining</em> a class. So in that case, you are creating a class that somebody else could instantiate with a particular type in place of T. For example, I could create an object of type <code>Pool&lt;String&gt;</code> using your class definition. That would mean two things:</p> <ul> <li>My <code>Pool&lt;String&gt;</code> would have an interface <code>PoolFactory&lt;String&gt;</code> with a <code>createObject</code> method that returns <code>String</code>s.</li> <li>Internally, the <code>Pool&lt;String&gt;</code> would contain an <code>ArrayList</code> of Strings.</li> </ul> <p>This is great news, because at another time, I could come along and create a <code>Pool&lt;Integer&gt;</code> which would use the same code, but have <code>Integer</code> wherever you see <code>T</code> in the source.</p>
    singulars
    1. This table or related slice is empty.
    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.
    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