How can I know the instance of java.util.Arrays$ArrayList
. I\'ve tried this code snippet but it does not work at all :
if (myList instanceof Arrays)
in case the list comes from Arrays#asList
, the returned ArrayList is NOT java.util.ArrayList
, therefore a comparison to this class will always fail.
The question is, why do you need to know that it is exactly this implementation ? Maybe it is enough to check for java.util.List
?
In general it is questionable why you need the instanceof operator at all, often there are other design solutions better.