I need to check if the returned list was created once or if it is a copy of the object. Can I find out his address?
// thread 1 List<Object> list = supplier.get(); System.out.print("list: " + list + "@" + getAddress(list)); // thread 2 List<Object> list = supplier.get(); System.out.print("list: " + list + "@" + getAddress(list));
What does getAddress(list) look like? The problem is that hashCode() , which usually returns the address, is overridden by AbstractList , so it returns the correct hash code instead of the address.
java
Andrey Chaschev
source share