Package java.util

Examples of java.util.HashMap


        }
    }

    static class HashEntityMap extends MapIntMap {
        public HashEntityMap() {
            mapNameToValue = new HashMap();
            mapValueToName = new HashMap();
        }
View Full Code Here


            lastModified = directory.lastModified();

            File[] list = directory.listFiles();

            ArrayList newRepositories = new ArrayList(list.length);
            HashMap newResources = new HashMap(list.length);

            for (int i = 0; i < list.length; i++) {
                // create both directories and zip files as top-level repositories,
                // while resources (files) are ignored.
                if (list[i].isDirectory()) {
View Full Code Here

        assertTrue(keys.contains(null));
        assertTrue(keys.size() == 3);
    }
       
    public void testPutAll() {
        Map map = new HashMap();
        map.put("One", "One");
        map.put("Two", "Two");
        map.put("one", "Three");
        map.put(null, "Four");
        map.put(new Integer(20), "Five");
        Map caseInsensitiveMap = new CaseInsensitiveMap(map);
        assertTrue(caseInsensitiveMap.size() == 4); // ones collapsed
        Set keys = caseInsensitiveMap.keySet();
        assertTrue(keys.contains("one"));
        assertTrue(keys.contains("two"));
View Full Code Here

     */
    public synchronized void update() {
        if (!directory.exists()) {
            repositories = emptyRepositories;
            if (resources == null) {
                resources = new HashMap();
            } else {
                resources.clear();
            }
            lastModified = 0;
            return;
        }

        if (directory.lastModified() != lastModified) {
            lastModified = directory.lastModified();

            File[] list = directory.listFiles();

            ArrayList newRepositories = new ArrayList(list.length);
            HashMap newResources = new HashMap(list.length);

            for (int i = 0; i < list.length; i++) {
                if (list[i].isDirectory()) {
                    // a nested directory aka child file repository
                    newRepositories.add(new FileRepository(list[i], this));
                } else if (list[i].getName().endsWith(".zip")) {
                    // a nested zip repository
                    newRepositories.add(new ZipRepository(list[i], this));
                } else if (list[i].isFile()) {
                    // a file resource
                    FileResource resource = new FileResource(list[i], this);
                    newResources.put(resource.getShortName(), resource);
                }
            }

            repositories = (Repository[])
                    newRepositories.toArray(new Repository[newRepositories.size()]);
View Full Code Here

        SAXParser parser = factory.newSAXParser();

        rootNode = helmaNode;
        currentNode = null;
        convertedNodes = new HashMap();
        nodeStack = new Stack();
        parsingHopObject = true;

        parser.parse(in, this);
View Full Code Here

    public INode convert(InputStream in, INode helmaNode)
                  throws RuntimeException {
        Document document = XmlUtil.parse(in);

        if ((document != null) && (document.getDocumentElement() != null)) {
            return convert(document.getDocumentElement(), helmaNode, new HashMap());
        } else {
            return helmaNode;
        }
    }
View Full Code Here

    public INode convertFromString(String xml, INode helmaNode)
                            throws RuntimeException {
        Document document = XmlUtil.parse(new InputSource(new StringReader(xml)));

        if ((document != null) && (document.getDocumentElement() != null)) {
            return convert(document.getDocumentElement(), helmaNode, new HashMap());
        } else {
            return helmaNode;
        }
    }
View Full Code Here

    // Modification Operations - check for readonly

    public synchronized Object put(Object key, Object value) {
        if (!modified) {
            wrapped = new HashMap(wrapped);
            modified = true;
        }
        return wrapped.put(key, value);
    }
View Full Code Here

        return wrapped.put(key, value);
    }

    public synchronized Object remove(Object key) {
        if (!modified) {
            wrapped = new HashMap(wrapped);
            modified = true;
        }
        return wrapped.remove(key);
    }
View Full Code Here

        return wrapped.remove(key);
    }

    public synchronized void putAll(Map t) {
        if (!modified) {
            wrapped = new HashMap(wrapped);
            modified = true;
        }
        wrapped.putAll(t);
    }
View Full Code Here

TOP

Related Classes of java.util.HashMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.