Since allPlaces
is an instance field, it is initialized during construction of a Places
object. So you create a Places
object, which creates a List<Places>
, which creates another Places
object in its collection initializer, which creates another List<Places>
of its own... a never ending recursion.
You probably wanted to create a static allPlaces
field, which would create only one list. Add the static
keyword to the field as follows:
public static List<Places> allPlaces = ...