Well the question says it all. Heres an Example of what i want
String s = new String();
List<s.type> ls = new ArrayList<s.type>();
Something like that, or any elegant way to achieve this, please no multiple if conditions or condition logic, as there may be unlimited data types, i have used string here only as an example, it can be anything.
If I understood you correctly, you want to know the class (type) of an instance (object) in runtime (existing), which has nothing to do with generics though, as Petr explained.
which outputs:
However, such approach is rarely needed, so rethink is there a simpler solution to your problem. If you still want to tackle it like this:
EDIT:
The other interpretation of your question leads to a dynamic generic list as answer: