0

Declared

List list= new ArrayList<MyObject>();
MyObject mo = new MyObject();
mo.setFieldOne("A");

list.add(mo);

Why does results contain null elementData?

results contains null elements, though arraylist.size(0) is only 1

2
  • This is internal array implementation. Its member variable objectData which happens to be the internal buffer of the ArrayList which actually stores elements you add. Commented Mar 10, 2017 at 12:13
  • just change List list= new ArrayList<MyObject>(); to ArrayList<MyObject> list= new ArrayList<MyObject>(); Commented Mar 10, 2017 at 12:32

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.