0

I don't recognize this kind of form Java syntax for constructor - granted I do very little Java now (taken from there):

new PersistentArrayMap(new Object[]{formKey, form});

I was expecting something along the lines of new Object(...) as parameter. Could someone decompose the above line ?

nha
  • 16,863
  • 11
  • 86
  • 120

2 Answers2

2

You are creating new Object array Object[] initialised to {obj1, obj2}

diginoise
  • 7,084
  • 2
  • 29
  • 37
1

It is a way of declaring and initializing an array in java. A simpler example is the following:

int[] myIntArray = new int[]{1,2,3};
pleft
  • 7,009
  • 2
  • 18
  • 42