001
014
015 package com.liferay.portal.kernel.concurrent;
016
017 import java.util.Map;
018 import java.util.concurrent.ConcurrentHashMap;
019 import java.util.concurrent.ConcurrentMap;
020
021
024 public class ConcurrentIdentityHashMap<K, V>
025 extends ConcurrentMapperHashMap<K, IdentityKey<K>, V, V> {
026
027 public ConcurrentIdentityHashMap() {
028 this(new ConcurrentHashMap<IdentityKey<K>, V>());
029 }
030
031 public ConcurrentIdentityHashMap(
032 ConcurrentMap<IdentityKey<K>, V> innerConcurrentMap) {
033
034 super(innerConcurrentMap);
035 }
036
037 public ConcurrentIdentityHashMap(int initialCapacity) {
038 this(new ConcurrentHashMap<IdentityKey<K>, V>(initialCapacity));
039 }
040
041 public ConcurrentIdentityHashMap(
042 int initialCapacity, float loadFactor, int concurrencyLevel) {
043
044 this(
045 new ConcurrentHashMap<IdentityKey<K>, V>(
046 initialCapacity, loadFactor, concurrencyLevel));
047 }
048
049 public ConcurrentIdentityHashMap(Map<? extends K, ? extends V> map) {
050 this(new ConcurrentHashMap<IdentityKey<K>, V>());
051
052 putAll(map);
053 }
054
055 @Override
056 protected IdentityKey<K> mapKey(K key) {
057 return new IdentityKey<>(key);
058 }
059
060 @Override
061 protected IdentityKey<K> mapKeyForQuery(K key) {
062 return new IdentityKey<>(key);
063 }
064
065 @Override
066 protected V mapValue(K key, V value) {
067 return value;
068 }
069
070 @Override
071 protected V mapValueForQuery(V value) {
072 return value;
073 }
074
075 @Override
076 protected K unmapKey(IdentityKey<K> identityKey) {
077 return identityKey.getKey();
078 }
079
080 @Override
081 protected K unmapKeyForQuery(IdentityKey<K> identityKey) {
082 return identityKey.getKey();
083 }
084
085 @Override
086 protected V unmapValue(V value) {
087 return value;
088 }
089
090 @Override
091 protected V unmapValueForQuery(V value) {
092 return value;
093 }
094
095 }