how to get values of my poll object?
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.
精彩评论