0

i tried the following

ArrayList<FileFilter>[] allFilters = new ArrayList<FileFilter>()[10]

and i get

The type of the expression must be an array type but it resolved to ArrayList<FileFilter>

is it possible (i'm using java). btw reason i am doing it is because i am trying to filter out files. some filters are or_filters, in which case i put them all in the same place in the regular array, and some are and_filters which are in another place in the regular array. is there any better idea?

yotamoo
  • 5,334
  • 13
  • 49
  • 61

1 Answers1

1

Get rid of the parentheses on the right. You are actually calling the constructor for a single instance of ArrayList:

ArrayList<FileFilter>[] allFilters = new ArrayList<FileFilter>[10];

Edit: Note that this doesn't actually create any ArrayList objects; it just creates an array of 10 references, all set to null. You'll have to fill in the elements of the array.

Ted Hopp
  • 232,168
  • 48
  • 399
  • 521