Statistics
| Revision:

gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.lib / src / main / java / org / gvsig / tools / util / UnmodifiableBasicMapAdapter.java @ 2335

History | View | Annotate | Download (1.3 KB)

1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.tools.util;
7

    
8
import java.util.Collections;
9
import java.util.Iterator;
10
import java.util.Map;
11

    
12
/**
13
 *
14
 * @author jjdelcerro
15
 * 
16
 * @param <K> the type of keys maintained by this map
17
 * @param <V> the type of mapped values
18
 *
19
 */
20
public class UnmodifiableBasicMapAdapter<K,V> implements UnmodifiableBasicMap<K,V> {
21

    
22
    private final Map<K,V> map;
23

    
24
    public UnmodifiableBasicMapAdapter(Map<K,V> map) {
25
        this.map = map;
26
    }
27
    
28
    @Override
29
    public V get(K key) {
30
        return this.map.get(key);
31
    }
32

    
33
    @Override
34
    public int size() {
35
        return this.map.size();
36
    }
37

    
38
    @Override
39
    public boolean isEmpty() {
40
        return this.map.isEmpty();
41
    }
42

    
43
    @Override
44
    public Iterator<V> iterator() {
45
        return this.map.values().iterator();
46
    }
47

    
48
    @Override
49
    public UnmodifiableBasicSet keySet() {
50
        return new UnmodifiableBasicSetAdapter(this.map.keySet());
51
    }
52

    
53
    @Override
54
    public boolean containsKey(K key) {
55
        return this.map.containsKey(key);
56
    }
57

    
58
    @Override
59
    public Map<K, V> toMap() {
60
        return Collections.unmodifiableMap(this.map);
61
    }
62
    
63
}