title: How to create Record class in Java?
body: <p>I have the following class <code>Type</code>:</p>
  
  <pre><code>class Type{
      String type;
      public Type(String type){
          this.type = type;
      }
  }
  </code></pre>
  
  <p>I have few types initialised here:</p>
  
  <pre><code>Type cor = new Type("cor");
  Type name = new Type("name")
  </code></pre>
  
  <p>and Now I want to have a class called <code>Record</code>,</p>
  
  <pre><code>class Record{
      String name;
      Type[] types;
      public Record(String name, Type[] types){
          this.name = name;
          this.types = types;
      }
  }
  </code></pre>
  
  <p>Well I got stuck here. What I want to do is when initialise an instance of the class <code>Record</code>, like this:</p>
  
  <pre><code>Record rec = new Record("Position", ...);
  </code></pre>
  
  <p>it should be something like this, I will give an example of the position record here:</p>
  
  <pre><code>Record Position = [cor x, cor y, name z];
  </code></pre>
  
  <p>So is using Type[] a good choice here? I find it hard to both record the type and the variable name such as <code>x</code>, <code>y</code>;
  Or should I use a HashMap?</p>