View Javadoc
1   package net.anyflow.lannister.cluster;
2   
3   import java.util.Set;
4   
5   import com.google.common.collect.Maps;
6   
7   /*
8    * Copyright 2016 The Lannister Project
9    * 
10   * Licensed under the Apache License, Version 2.0 (the "License");
11   * you may not use this file except in compliance with the License.
12   * You may obtain a copy of the License at
13   * 
14   *     http://www.apache.org/licenses/LICENSE-2.0
15   * 
16   * Unless required by applicable law or agreed to in writing, software
17   * distributed under the License is distributed on an "AS IS" BASIS,
18   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19   * See the License for the specific language governing permissions and
20   * limitations under the License.
21   */
22  public class NativeMap<K, V> implements Map<K, V> {
23  
24  	private java.util.Map<K, V> engine;
25  
26  	public NativeMap(String name) {
27  		engine = Maps.newConcurrentMap();
28  	}
29  
30  	@Override
31  	public void put(K key, V value) {
32  		engine.put(key, value);
33  	}
34  
35  	@Override
36  	public V get(K key) {
37  		return engine.get(key);
38  	}
39  
40  	@Override
41  	public V remove(K key) {
42  		return engine.remove(key);
43  	}
44  
45  	@Override
46  	public Set<K> keySet() {
47  		return engine.keySet();
48  	}
49  
50  	@Override
51  	public int size() {
52  		return engine.size();
53  	}
54  
55  	@Override
56  	public void dispose() {
57  		// DO NOTHING
58  	}
59  
60  	@Override
61  	public boolean containsKey(K key) {
62  		return engine.containsKey(key);
63  	}
64  }