bigBA
July 22nd, 2008, 04:54 AM
Hi,
i have a method which gets some kind of output from a data call and in case that output is a List<?> turns it into an UnmodifiableList.
if (callOutput instanceof List<?>)
{
callOutput = Collections.unmodifiableList((List<? extends Object>) callOutput);
}
now i would like add the check if callOutput isn't already an instance of UnmodifiableList<?>.
Has anyone an idea how to it?
instanceof UnmodifiableList does not work because UnmodifiableList is declared as inner class of java.util.Collections without any visibility modifier and therefor not public.
i have a method which gets some kind of output from a data call and in case that output is a List<?> turns it into an UnmodifiableList.
if (callOutput instanceof List<?>)
{
callOutput = Collections.unmodifiableList((List<? extends Object>) callOutput);
}
now i would like add the check if callOutput isn't already an instance of UnmodifiableList<?>.
Has anyone an idea how to it?
instanceof UnmodifiableList does not work because UnmodifiableList is declared as inner class of java.util.Collections without any visibility modifier and therefor not public.