S
S
Sasha Brahms2016-07-01 08:22:47
Java
Sasha Brahms, 2016-07-01 08:22:47

How to pass any type of data to HashMap?

Hello, I'm interested in how you can transfer any type of data to HashMap, for example

HashMap m = new HashMap<Sring, ?>();
m.put("one", 1);
m.put("two", "2");
m.put("new", 2.3);

I will be very grateful

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
protven, 2016-07-01
@Dlike

HashMap<String, Object>
But usually this is a bad idea.
PS And String, not Sring, I guess.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question