Code example for TreeMap

Methods: clear, containsKey, get

0
            // special case in ZIPs, we do not want this thing included 
            return new Resource("", true, Long.MAX_VALUE, true);
        } 
        // first check if the archive needs to be scanned again 
        scanme(); 
        if (fileEntries.containsKey(name)) {
            return (Resource) fileEntries.get(name);
        } 
        name = trimSeparator(name);
 
        if (dirEntries.containsKey(name)) {
            return (Resource) dirEntries.get(name);
        } 
        return new Resource(name);
    } 
 
    /** 
     * Fills the file and directory maps with resources read from the archive. 
     * 
     * @param archive the archive to scan. 
     * @param encoding encoding used to encode file names inside the archive. 
     * @param fileEntries Map (name to resource) of non-directory 
     * resources found inside the archive. 
     * @param matchFileEntries Map (name to resource) of non-directory 
     * resources found inside the archive that matched all include 
     * patterns and didn't match any exclude patterns. 
     * @param dirEntries Map (name to resource) of directory 
     * resources found inside the archive. 
     * @param matchDirEntries Map (name to resource) of directory 
     * resources found inside the archive that matched all include 
     * patterns and didn't match any exclude patterns. 
     */ 
    protected abstract void fillMapsFromArchive(Resource archive,
                                                String encoding,
                                                Map fileEntries,
                                                Map matchFileEntries,
                                                Map dirEntries,
                                                Map matchDirEntries);
 
    /** 
     * if the datetime of the archive did not change since 
     * lastScannedResource was initialized returns immediately else if 
     * the archive has not been scanned yet, then all the zip entries 
     * are put into the appropriate tables. 
     */ 
    private void scanme() { 
        if (!src.isExists() && !errorOnMissingArchive) {
            return; 
        } 
 
        //do not use a FileResource b/c it pulls File info from the filesystem: 
        Resource thisresource = new Resource(src.getName(),
                                             src.isExists(),
                                             src.getLastModified());
        // spare scanning again and again 
        if (lastScannedResource != null
            && lastScannedResource.getName().equals(thisresource.getName())
            && lastScannedResource.getLastModified()
            == thisresource.getLastModified()) {
            return; 
        } 
        init(); 
 
        fileEntries.clear();
        dirEntries.clear();
        matchFileEntries.clear();
        matchDirEntries.clear();
        fillMapsFromArchive(src, encoding, fileEntries, matchFileEntries,
                            dirEntries, matchDirEntries);