java - Adding a generic arraylist to an arraylist -


so have these 4 classes/interface:

  public class box <s extends someclass> implements comparable <box<s>> {...}   public interface someclass <t extends comparable<t>> {...}   public class thisitem implements someclass {...}   public class otheritem implements someclass {...} 

and trying create list of box holds list of instances of thisitem. i'm unsure why giving me error.

  public arraylist<arraylist<box>> variable = new arraylist<arraylist<box>>();   this.variable.add(new arraylist<box<thisitem>>(5)); 

box generic class, when use box, raw type, different box<thisitem>, has type parameter specified. similar arraylist<box>, box type parameter.

change this:

public arraylist<arraylist<box>> variable = new arraylist<arraylist<box>>(); 

to:

public arraylist<arraylist<box<thisitem>>> variable = new arraylist<arraylist<box<thisitem>>>(); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -