1

I have the following code

ParameterExpression<String>[] searchStrings = new ParameterExpression[10];

Which works but will give a warning stating that I am doing an "unchecked" operation which is the case.

I want to get rid of the warning without doing a @SupressWarnings but if I do

ParameterExpression<String>[] searchStrings = new ParameterExpression<String>[10];

I get an error

Cannot create a generic array of ParameterExpression

Is there anyway to remove the warning without using @SupressWarnings?

Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265

1 Answers1

0

With arrays, you cannot initialize using generic classes, but you can do a list

List<ParameterExpression<String>> searchStrings = new ArrayList<>();
Eddie Martinez
  • 13,582
  • 13
  • 81
  • 106