I\'m new to Java so I\'m probably doing something wrong here, I want to create an array of Sets and I get an error (from Eclipse). I have a class:
public class R
From http://www.ibm.com/developerworks/java/library/j-jtp01255/index.html:
you cannot instantiate an array of a generic type (
new Listis illegal), unless the type argument is an unbounded wildcard ([3] new List>[3]is legal).
Rather than using an array, you can use an ArrayList:
List> groupMembers = new ArrayList>();
The code above creates an empty ArrayList of Set objects. You would still have to instantiate every Set object that you put into the ArrayList.