Code example for HashSet

Methods: add, size, toArray

0
    public void setChildNodes(PermissionTreeNodeDTO[] childNodes) {
        this.childNodes = Arrays.copyOf(childNodes, childNodes.length);
    } 
 
    public void addChildNode(PermissionTreeNodeDTO node){
        Set<PermissionTreeNodeDTO> valueNodes = new HashSet<PermissionTreeNodeDTO>(Arrays.asList(this.childNodes));
        valueNodes.add(node);
        this.childNodes = valueNodes.toArray(new PermissionTreeNodeDTO[valueNodes.size()]);
    } 
 
    public String getName() {
        return name;
    } 
 
    public String getModuleName() {
        return moduleName;
    } 
 
    public void setModuleName(String moduleName) {
        this.moduleName = moduleName;
    }