I want to implement a Map of functions. I have several functions for inserting different data in SQLite database (InsertUSER_Data()
, InsertMessages()
) and so on. I want to create a Map and to call a specific function by a key command. As I see during search there are two approaches for this: anonymous classes and reflection. (e.g. here How to call a method stored in a HashMap? (Java)) I really like the approach based on Reflection API (via a Method type) : Map <String, Method>
instead of just using anonymous classes which implement interface.
But I have doubts: is it a really big performance overhead in this solution, especially if I'll use it in Android or it's not really significant? Detail explanation will be very helpful.