title: How to initialize Java Collection List a Map inside
body: <pre><code>@Entity
  
  public class SalesT {
  
      @Id
      @GeneratedValue
      private int id;
  
      @OneToOne
      private Customer customer;
  
      @OneToMany(targetEntity = Product.class)
      private List&lt; Map&lt;Product,Integer&gt; &gt; listProduct;// I want to intialize this
  
      public SalesT() {
      }
  
      public SalesT(Customer customer, List&lt;Map&lt;Product, Integer&gt;&gt; product) {
          this.customer = customer;
          this.listProduct = product;
      }
  }
  </code></pre>
  
  <p>I want to Initialize List&lt; Map &lt; Product,Integer>> listProduct attribute of the SalesT Class, How do I initialize it?. I tried Like this</p>
  
  <pre><code>List&lt;Map &lt;Product, Integer&gt;&gt; listProduct = new ArrayList &lt;HashMap &lt;Product, Integer&gt;&gt;();
  </code></pre>
  
  <p>but it is not working.  </p>
  
  <p>Thank you.</p>