title: getting a class having the same generic type of another class
body: <p>This is my first question here, so thanks to everybody who make this forum lives.</p>
  
  <p>I want my Image2D class to have the same generic type of my Point2D class.</p>
  
  <p>Image2D.java :</p>
  
  <pre><code> package utilities;
  
  import ij.ImagePlus;
  import utilities.Point2D;
  
  public class Image2D&lt;T&gt; {
  
      ArrayList&lt;Point2D&lt;T&gt;&gt; original = new ArrayList&lt;Point2D&lt;T&gt;&gt;();
  
      public Image2D(ImagePlus imp) {
          // imp.getProcessor().getIntArray() returns a int[][]
          this.original = matrixToImage2D(imp.getProcessor().getIntArray());
      }
  
      private static &lt;T&gt; ArrayList&lt;Point2D&lt;T&gt;&gt; matrixToImage2D(T[][] matrix) {
  
          ArrayList&lt;Point2D&lt;T&gt;&gt; img = new ArrayList&lt;Point2D&lt;T&gt;&gt;();
  
          for (int row=0; row&lt;matrix.length; row++) {
              for (int col=0; col&lt;matrix[row].length; col++) {
                  img.add(new Point2D(col, row, matrix[row][col]));
              }
          }
  
          return img;
      }
  
  }
  </code></pre>
  
  <p>Point2D.java:</p>
  
  <pre><code>package utilities;
  
  public class Point2D&lt;T&gt; {
  
      public int x;
      public int y;
      public T value;
  
      public Point2D(int col, int row, T value) {
          this.x = col;
          this.y = row;
          this.value = value;
      }
  
      public int getX() {
          return this.x;
      }
  
      public int getY() {
          return this.y;
      }
  
      public T getValue() {
          return this.value;
      }
  }
  </code></pre>
  
  <p>I must not use the good concept to do that, I just put the code to illustrate my idea.
  Please can anyone tell me the java concepts I have to use ?</p>
  
  <p>Thanks.</p>