Java question about ArrayList[] x

后端 未结 6 1713
臣服心动
臣服心动 2021-02-06 08:41

I have always had this one issue with arrays of ArrayLists. Maybe you can help.

//declare in class
private ArrayList[] x;

//in constructor
x=new          


        
6条回答
  •  半阙折子戏
    2021-02-06 09:25

    You can't make a array of generics lists. Fortunately, there are workarounds. And even more fortunately, there is a nice site about Generics with more information than you'd ever want to know. The link goes straight to the Arrays in Java Generics part.

提交回复
热议问题