Originally Posted by
ClipOS
...I want to not have to open the class I am retrieving to check what type is returning...
...Not primitives, but, how about data structures like Set, List, ArrayList, HashMap? ...
I am not sure you got an answer already but I wrote my answer below :
Because of two statements above, I ended up that : "you want to check what is the returning object's class, whether it is Set or ArrayList or HashMap etc." am I right?
If I am right, then ; there is an instanceof() operator in Java , and you can find more on
https://docs.oracle.com/en/java/java...-operator.html. In that page you can find that different classes defined for shape and which one of them returned determined by instanceof() operator. You can do similar for Set, ArrayList or any other classes I think. Also classes on the link(i.e Rectangle,Circle tc.) are all derived from(in exact word implemented from) an abstract class(i.e. interface) Shape. You can catch and follow this hint/tip and you can go further from there.
However, if you want to do something else, both my assumption and answer is not valid.