return sort((DownloadMainNode[])children.toArray(new DownloadMainNode[children.size()]));
if (sort || sortedChildNodes == null) { return sort((DownloadMainNode[]) children.toArray(new DownloadMainNode[children.size()])); } else { return sortedChildNodes; }
    public Object[] getChildren(){        if (downloads==null)            return null;        DownloadDO downloadDO;        HashMap targetDirs = new HashMap();        MapSetStringKey key;        DownloadDirectoryNode newNode;        synchronized(this){            int childCount = children.size();   //alte Downloads entfernen            Object obj;            for (int i=childCount-1; i>=0; i--){                obj = children.get(i);                if (obj.getClass()==DownloadMainNode.class){                    key = new MapSetStringKey(((DownloadMainNode)obj).getDownloadDO().getId());                    if (!downloads.containsKey(key) || (versteckt && versteckteNodes.containsKey(key))){                        children.remove(i);                    }                }            }            Iterator it = downloads.values().iterator();            String pfad;            PathEntry pathEntry;            MapSetStringKey mapKey;            while (it.hasNext()){                downloadDO = (DownloadDO)it.next();                mapKey = new MapSetStringKey(downloadDO.getId());                if (versteckt && versteckteNodes.containsKey(mapKey)){                    continue;                }                pfad = downloadDO.getTargetDirectory();                pathEntry = (PathEntry)childrenPath.get(mapKey);                if (pathEntry!=null){                    if (pathEntry.getPfad().compareToIgnoreCase(pfad)!=0){ //geaenderter Download                        children.remove(pathEntry.getObj());                        childrenPath.remove(mapKey);                    }                    else{                        continue;                    }                }                if (pathEntry==null ){ //neuer Download                    if (pfad==null || pfad.length()==0){                        childrenPath.put(mapKey, new PathEntry("", downloadDO));                        children.add(new DownloadMainNode(downloadDO));                    }                    else{                        key = new MapSetStringKey(downloadDO.getTargetDirectory());                        if (!targetDirs.containsKey(key)){                            childrenPath.put(mapKey, new PathEntry(downloadDO.getTargetDirectory(), downloadDO));                            newNode = new DownloadDirectoryNode(downloadDO.getTargetDirectory());                            targetDirs.put(key, newNode);                            children.add(newNode);                        }                    }                }            }        }        return sort((DownloadMainNode[])children.toArray(new DownloadMainNode[children.size()]));    }