Q:

Keep items in ArrayList

I'm working on a class which is a view for a backend-class and needs to display some of the backend-classes properties. 
public abstract class AGenericNodeView{
    private ANode fObject;  
    private ArrayList<TInputView> fInputs = null;

    public AGenericNodeView(){
        super();
        this.fInputs = new ArrayList<TInputView>();
    }

    private void getInputs(){
        int num = fObject.getNumInputs(); //Number of inputs
        for (int i = 0; i < num; i++)
        {
            this.fInputs.add(new TInputView());
            this.fInputs.get(i).doSth();  
        }
        //fInputs has now the size num which is greater than 0. 
    }    

   //later I call:
   public draw()
   {
      //...
      log(this.fInputs.size()); //output fInputs.size()
      // and it is 0. Always. 
   }

}

I wonder, if there is a way, to keep the Objects I create in getInputs() persistent, so that the list is not empty, when needed in draw()?

A:

A couple of suggestions:

Use a debugger. 
Log num in getInputs
Log System.identityHashCode(fInputs) in getInputs and in draw and verify they are same. 

