2 Replies Latest reply on Jul 2, 2012 2:42 PM by 946867

    ArrayList lost it's data

      Hi, my situation is,
      I have an ArrayList that lost it's data when its populate by a property List from a singleton class.

      More detailed :*

      I have a private variable (hostelCategoryList in Agenda singleton class :
      List<Category> hostelCategoryList = new ArrayList<Category>(); // it's have getter and setter

      In static void main class, I call my agenda singleton instance :
      Agenda agenda = Agenda.getInstance();

      I want to put a List<Category> in my hostelCategoryList (My List<Category> is in a CategoryCatalog singleton class) :

      CategoryCatalog categoryCatalog = CategoryCatalog.getInstance();
      agenda.setHostelCategoryList( categoryCatalog.getCategoryList() );

      later... my hostelCategoryList is empty...

      Suprisely, if I put a List<Category> like this, it's work :

      List<Category> categoryList = new ArrayList<Category>();
      categoryList.add(new Category);

      agenda.setHostelCategoryList( categoryList );

      // It's work ! Later, my hostelCategoryList is not empty !

      Whats the problem ?

      Thank you very much to look my code.

      Francis G-Tessier