Code example for HashSet

Methods: iterator, remove

0
        langSet.remove(language);
         
        this.languageVersions.remove(resource.getPath());
         
        if (langSet.isEmpty()) {
            this.pages.remove(langSet);
        } 
         
        save(); 
    } 
     
    public synchronized boolean hasTranslation(Resource resource, String language) throws TranslationException {
        Page langSet = getPage(resource);
        if (langSet == null) {
            return false; 
        } 
        return langSet.containsKey(language);
    } 
     
     
     
    protected synchronized LanguageVersion getLanguageVersion(String path) throws TranslationException {
        return (LanguageVersion)this.languageVersions.get(path);
    } 
 
    protected synchronized Page getPage(Resource resource) throws TranslationException {
        LanguageVersion langVersion = getLanguageVersion(resource.getPath());
        if (langVersion == null) {
            return null; 
        } 
        return langVersion.page;
    } 
     
    protected synchronized void load() throws TranslationException { 
        try { 
            SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
            InputStream is = this.node.getInputStream();
            saxParser.parse(is, new TranslationSAXHandler());
            //debug(); 
        } catch (Exception e) {
            log.error(e, e);
            throw new TranslationException(e.getMessage(), e);
        } 
    } 
     
    protected synchronized void save() throws TranslationException { 
        try { 
            OutputStream os = this.node.getOutputStream();
            Writer out = new OutputStreamWriter(os);
            out.write("<?xml version='1.0'?>\n");
            out.write("<pages>\n");
            Iterator pageIter = this.pages.iterator();
            while (pageIter.hasNext()) {
                out.write("<page>\n");
                Page page = (Page)pageIter.next();
                Iterator iter = page.keySet().iterator();
                while (iter.hasNext()) {