Can someone explain what the following does?
private HashSet nodes[];
nodes = new HashSet[21];
I’m a little confused… in the difference between
private HashSet nodes = new HashSet;
and the above, particularly in terms of the square brackets syntax. Is this an array of HashSets? Because normally I’m used to seeing
int[] myarray = new int[21];
Or something like that.
Yes, it is an array of
HashSets.is the same as
The difference in where you place the brackets only becomes important when you use commas to declare a bunch of variables at a time: