public List<String> getCategories() {
        if (categories == null) {
            ArrayList<String> list = new ArrayList<>();
            Iterator it = this.iterator();
            while (it.hasNext()) {
                Term term = (Term)it.next();
                if (term.getCategory() != null &&
                        !list.contains(term.getCategory())) {
                    list.add(term.getCategory());
                }            
            }
            categories = list;
        }
        return categories;
    }