Revision 1815

View differences:

org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/folders/impl/DefaultFoldersManager.java
68 68
        });
69 69
    }
70 70

  
71
    private Map<String, File> getFolders() {
72
        if( this.folders == null ) {
73
            this.folders = new HashMap<>();
74
        }
75
        return this.folders;
76
    }
77
    
71 78
    @Override
79
    public boolean isEmpty() {
80
        return this.folders == null || this.folders.isEmpty();
81
    }
82

  
83
    @Override
72 84
    public void setLastPath(String pathId, File path) {
73
        this.folders.put("last.path." + pathId, path);
85
        this.getFolders().put("last.path." + pathId, path);
74 86
    }
75 87

  
76 88
    @Override
77 89
    public File getLastPath(String pathId, File defaultValue) {
78
        File path = this.folders.get("last.path." + pathId);
90
        File path = this.getFolders().get("last.path." + pathId);
79 91

  
80 92
        if (path != null) {
81 93
            return path;
......
186 198

  
187 199
    @Override
188 200
    public void set(String id, File file) {
189
        if (this.folders == null) {
190
            this.folders = new HashMap<>();
191
        }
192
        this.folders.put(id, file);
201
        this.getFolders().put(id, file);
193 202
    }
194 203

  
195 204
    @Override
196 205
    public File get(String id) {
197
        if (this.folders == null) {
198
            this.folders = new HashMap<>();
199
        }
200
        return this.folders.get(id);
206
        return this.getFolders().get(id);
201 207
    }
202 208

  
203 209
    @Override
204 210
    public File get(String id, File defaultValue) {
205
        if (this.folders == null) {
206
            this.folders = new HashMap<>();
211
        if (this.getFolders().containsKey(id)) {
212
            return this.getFolders().get(id);
207 213
        }
208
        if (this.folders.containsKey(id)) {
209
            return this.folders.get(id);
210
        }
211 214
        return defaultValue;
212 215
    }
213 216

  
......
219 222
    
220 223
    @Override
221 224
    public Iterator<String> iterator() {
222
        if (this.folders == null) {
223
            this.folders = new HashMap<>();
224
        }
225
        return this.folders.keySet().iterator();
225
        return this.getFolders().keySet().iterator();
226 226
    }
227 227

  
228
    @Override
229
    public boolean isEmpty() {
230
        return this.folders == null || this.folders.isEmpty();
231
    }
232

  
233 228
}

Also available in: Unified diff