从HashMap中提取值

问题描述:

我试图从HashMap的工作中学习和理解.因此,我创建了此哈希图来存储某些值,这些值在使用Iterator进行显示时会显示为

I was trying to learn and make understanding out of the working of a HashMap. So i created this hashmap to store certain values which upon displaying using an Iterator gives me outputs as

 1=2
 2=3
 3=4

,依此类推.我使用Iterator.next()函数获得此输出.现在,我真正的疑问是,由于迭代器对象返回的该值的类型,如果我仅需要提取上述等式的右侧值,那么是否有任何功能?有点像子串.有什么办法可以让我得到

and so on. This output i obtain using the Iterator.next() function. Now what my actual doubt is that since the type of this value returned in of an Iterator Object, if i need to extract only the right hand side values of the above equalities, is there any function for that? Something like a substring. Is there any way i could just get results as

 2
 3
 4

任何帮助将不胜感激.预先感谢.

Any help will be appreciated. thanks in advance.

我会使用类似的

Map<Integer, Integer> map = new HashMap<>();

for(int value: map.values())
   System.out.println(value);