public CategoryListItem(Category category,CategoryListItem parentItem){
  name=category.getName();
  fullName=parentItem == null ? name : parentItem.fullName + " / " + name;
  key=category.getKey();
  List<Category> subCategories=category.getSubCategories();
  int cntSubCategories=subCategories == null ? 0 : subCategories.size();
  if (cntSubCategories == 0) {
    subItems=new CategoryListItem[0];
  }
 else {
    subItems=new CategoryListItem[cntSubCategories];
    for (int i=0; i < cntSubCategories; i++) {
      subItems[i]=new CategoryListItem(subCategories.get(i),this);
    }
    subItems[cntSubCategories - 1]=new CategoryListItem(name,fullName,key,null);
  }
}

public CategoryListItem ( Category category , CategoryListItem parentItem ) { name = category . getName ( ) ; fullName = parentItem == null ? name : parentItem . fullName + " / " + name ; key = category . getKey ( ) ; List < Category > subCategories = category . getSubCategories ( ) ; int cntSubCategories = subCategories == null ? 0 : subCategories . size ( ) ; if ( cntSubCategories == 0 ) { subItems = new CategoryListItem [ 0 ] ; } else { subItems = new CategoryListItem [ cntSubCategories ] ; for ( int i = 0 ; i < cntSubCategories ; i ++ ) { subItems [ i ] = new CategoryListItem ( subCategories . get ( i ) , this ) ; } subItems [ cntSubCategories - 1 ] = new CategoryListItem ( name , fullName , key , null ) ; } }
converts a category object into a categorylistitem .
