I am browsing an Android source, just read it, and I met a strange piece of code in Android.Util.JsonReader
. It looks like this:
private final List<JsonScope> stack = new ArrayList<JsonScope>(); { push(JsonScope.EMPTY_DOCUMENT); }
What does it do? That is, the scope immediately after assigning new
? If I understand correctly, whenever this class, JsonReader
is created, (not static, right?), The stack
will be initialized here, and not through this.stack = ...
in the constructor, right?
What does the scope do? Is stack
after stack
initialized? I'm just a little confused here as to the name of this template and its use.
source share