Cache.get(object) when using List and Arrays.asList as keys
Hi
I have seen an issue when doing cache.get(object) with List. Below is my test.
NamedCache cohCache = CacheFactory.getCache("Test");
// Key is a List
List key = new ArrayList();
key.add("A");
cohCache.put(key, 1);
System.out.println("Get with Arrays.asList: "+ cohCache.get(Arrays.asList("A")));
System.out.println("Get with List: "+ cohCache.get(key));
System.out.println("Is List equal to Arrays.asList: "+ Arrays.asList("A").equals(key));
Actual Output:
Get with Arrays.asList: null
Is List equal to Arrays.asList: true
Get with List: 1
Expected Output:
Get with Arrays.asList: 1
Is List equal to Arrays.asList: true
Get with List: 1
Arrays.asList("A") and key are equal but Coherence does not return the value. I thought, in cache.get(object) Coherence returns the value if object.equals(key) == true.
Any idea ?
reg
Dasun.