a and b are both ArrayLists, and their generic types cannot be obtained at runtime. You can try to take out an element from a or b, and then use instanceof to determine the type of the element, and then cast it.
In Java, generics only exist during the compilation phase, which means that generics will be erased during runtime. Then deserialization is all ArrayList. You can convert it into any ArrayList<T> before compiling. No judgment is made during runtime.
a and b are both ArrayLists, and their generic types cannot be obtained at runtime. You can try to take out an element from a or b, and then use instanceof to determine the type of the element, and then cast it.
In Java, generics only exist during the compilation phase, which means that generics will be erased during runtime.
Then deserialization is all ArrayList. You can convert it into any ArrayList<T> before compiling. No judgment is made during runtime.