-2

Its a similar question to this one: Initialization of an ArrayList in one line

I am trying to initialize a List Variable.

List<WebElement> variable = new List<WebElement>() {{
...
}};

This is not Working. No idea what I am doing wrong.

Community
  • 1
  • 1
Niko Lang
  • 549
  • 1
  • 5
  • 23

1 Answers1

2

List is an interface. You need a class to instantiate a list - like ArrayList.

M. Haverbier
  • 383
  • 2
  • 13