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
  • 22,850
  • 10
  • 113
  • 154

1 Answers1

0

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

List<ParameterExpression<String>> searchStrings = new ArrayList<>();
Eduardo Dennis
  • 12,511
  • 11
  • 72
  • 102