Skip to content
This repository was archived by the owner on Jul 18, 2018. It is now read-only.

[squid:S2293] The operator ("<>") should be used. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/main/java/org/elasticsearch/index/analysis/RedisHanlder.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class RedisHanlder {
private static ESLogger logger = Loggers.getLogger("sting2int");
private JedisPool jPool;
private static HashMap<String, RedisHanlder> instance = new HashMap<String, RedisHanlder>();
private static HashMap<String, RedisHanlder> instance = new HashMap<>();
private boolean local_mem_cache = true;
private boolean useLruCache = true;
private int capicity = 100000;
Expand Down Expand Up @@ -52,9 +52,9 @@ static RedisHanlder getInstance(String redis_server, int redis_port, boolean loc
}

if (useLruCache) {
local_lru_cache = new ConcurrentHashMap<String, LruCache<String, Integer>>();
local_lru_cache = new ConcurrentHashMap<>();
} else {
local_cache = new ConcurrentHashMap<String, ConcurrentHashMap<String, Integer>>();
local_cache = new ConcurrentHashMap<>();
}

RedisHanlder hanlder = new RedisHanlder(redis_server, redis_port, local_mem_cache, useLruCache);
Expand Down Expand Up @@ -110,11 +110,11 @@ private void set_local_cache(String redis_key, String item, Long value) {
lock.lock();
try {
if (useLruCache) {
ConcurrentLruCache<String, Integer> lruCache = new ConcurrentLruCache<String, Integer>(capicity, ttl, initialCapicity);
ConcurrentLruCache<String, Integer> lruCache = new ConcurrentLruCache<>(capicity, ttl, initialCapicity);
lruCache.put(item, value2);
local_lru_cache.put(redis_key, lruCache);
} else {
ConcurrentHashMap<String, Integer> localCache = new ConcurrentHashMap<String, Integer>();
ConcurrentHashMap<String, Integer> localCache = new ConcurrentHashMap<>();
localCache.put(item, value2);
local_cache.put(redis_key, localCache);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ public synchronized int usedEntries() {
* @return a <code>Collection</code> with a copy of the cache content.
*/
public synchronized Collection<Map.Entry<K,V>> getAll() {
return new ArrayList<Map.Entry<K,V>>(map.entrySet()); }
return new ArrayList<>(map.entrySet()); }

} // end class LRUCache
@Test
public void testLrc(){

LRUCache<String,String> c = new LRUCache<String, String>(3);
LRUCache<String,String> c = new LRUCache<>(3);
c.put ("1", "one"); // 1
c.put ("2", "two"); // 2 1
c.put ("3", "three"); // 3 2 1
Expand Down