Home » Java » Get Class of a concrete Map

Get Class of a concrete Map

Posted by: admin August 11, 2018 Leave a comment

Questions:

Given 2 Class objects how can I get the Class object of a Map?
For example, assume I have:

Class keyClass = Long.class;
Class valueClass = String.class;

How can I get the Class object ofMap<Long,String>?

Answers: