I have a little problem..I'm using a HashMap > to save values. But in certain cases I have to store a String instead of a List.
Is there a way to do some cast or something like that without having to create another Map?
Part of the code is as follows:
HashMap<String,List<Object>> message = new HashMap<>();
message.put("lista de juegos",user.getMyJuegos(IdPlayer));
message.put("error","Please try again later");
Where user.getMyJuegos (IdPlayer) returns a List with all the games of a player. And the error message is in case the player is not in the BD. The problem occurs in the line of the error message and is as follows: "no suitable method found for put (java.lang.String, java.lang.String)"
Thank you very much from now.