开发者

how to get values of my poll object?

开发者 https://www.devze.com 2023-03-15 04:40 出处:网络
I have my HashMap, private final HashMap<Integer, Poll> pollmap = new HashMa开发者_如何学编程p<Integer, Poll>();

I have my HashMap,

private final HashMap<Integer, Poll> pollmap = new HashMa开发者_如何学编程p<Integer, Poll>();

and my constructor is:

Poll(int id, String pollName, String question, String pollAnswerOptions[], boolean active)

How do I get the extract the Poll values such as pollname, question, etc FROM the pollmap hashmap?


Integer i = ... 
Poll poll = pollmap.get(i);

Then use whatever methods on the Poll object available to you to extract the values, e.g.,

poll.getId();
poll.getPollName();

and so on.


Get the Poll objects, and then on each object the values, like this:

pollmap.get(key).getPollName 

etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消