private Map<Integer,String> selected = new HashMap<Integer,String>();
selected.put(key,value);
方法一:
Iterator it =selected .keySet().iterator();
 while (it.hasNext())
{
Integer key=(Integer)it.next();
String xuehao=
selected .get(key);
 }
方法二:
Iterator it=adapter.getSelected().entrySet().iterator();//效率较高
while (it.hasNext())
{
Integer key=(Integer)it.next();
String xuehao=selected().get(key); }

HashMap的一般用法以及遍历方法的更多相关文章

  1. python基本数据类型list,tuple,set,dict用法以及遍历方法

    1.list类型 类似于java的list类型,数据集合,可以追加元素与删除元素. 遍历list可以用下标进行遍历,也可以用迭代器遍历list集合 建立list的时候用[]括号 import sys ...

  2. HashMap的四种遍历方法,及效率比较(简单明了)

    https://yq.aliyun.com/ziliao/210955 public static void main(String[] args) { HashMap<Integer, Str ...

  3. jQuery通用的全局遍历方法$.each()用法实例

    1.jQuery通用的全局遍历方法$.each()用法 2. test.json文件代码: 3. html代码 4.jQuery代码 <script src="jquery-1.3.1 ...

  4. HashMap集合-遍历方法

    # HashMap集合-遍历方法 先定义好集合: public static void main(String[] args) { Map<String,String> onemap=ne ...

  5. HashMap -双列集合的遍历与常用的方法

    package cn.learn.Map; /* java.util.Hashtable<k,y> implements Map<k,v> 早期双列集合,jdk1.0开始 同步 ...

  6. HashMap有几种遍历方法?推荐使用哪种?

    本文已收录<面试精选>系列,Gitee 开源地址:https://gitee.com/mydb/interview HashMap 的遍历方法有很多种,不同的 JDK 版本有不同的写法,其 ...

  7. ES6 数组遍历方法的实战用法总结(forEach,every,some,map,filter,reduce,reduceRight,indexOf,lastIndexOf)

    目录 forEach every some map filter reduce && reduceRight indexOf lastIndexOf 前言 ES6原生语法中提供了非常多 ...

  8. 集合类List,set,Map 的遍历方法,用法和区别

    遍历list: 方法一: for(String s:lists){ System.out.println(s); } 方法二: System.out.println("list with i ...

  9. map的三种遍历方法!

    map的三种遍历方法!   集合的一个很重要的操作---遍历,学习了三种遍历方法,三种方法各有优缺点~~ /* * To change this template, choose Tools | Te ...

随机推荐

  1. HDU 1561 树形DP(入门)

    题目链接:  HDU 1561 The more, The Better #include <iostream> #include <cstdio> #include < ...

  2. HDU 2199 Can you solve this equation? (二分 水题)

    Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

  3. ECSHOP文件目录详解

    ECShop 最新程序 的结构图及各文件相应功能介绍ECShop文件结构目录┣ activity.php 活动列表┣ affiche.php 广告处理文件┣ affiliate.php 生成商品列表┣ ...

  4. 兼容:判断 iframe 是否加载完成

    判断 iframe 是否加载完成其实与 判断 JavaScript 文件是否加载完成 采用的方法很类似 var iframe = document.createElement("iframe ...

  5. android123 zhihuibeijing 新闻中心-新闻 页签 ViewPagerIndicator实现

    ## ViewPagerIndicator ## 使用导入ViewPagerIndicator库的方式相当于可以改源码,打包编译Eclips可以自动完成. ViewPager指针项目,在使用ViewP ...

  6. jQuery中要注意的一些函数

    has()方法 或 :has选择器 :是过滤子类含有的,并不是过滤当前选择器选择的元素或对象含有的

  7. C#获取指定网页源码的几种方法

    // WebClient private string GetWebClient(string url) { string strHTML = ""; WebClient myWe ...

  8. Java基础知识强化之网络编程笔记15:Android网络通信之 Android异步任务处理(AsyncTask使用)

         AsyncTask,是android提供的轻量级的异步类,可以直接继承AsyncTask,在类中实现异步操作,并提供接口反馈当前异步执行的程度(可以通过接口实现UI进度更新),最后反馈执行的 ...

  9. ListVIew中插入view

    public class MainActivity extends Activity { private ListView listview; private List<String> d ...

  10. Swift 结构体和类

    //*---------------------结构体-------------*/ //swift结构体也具有封装的概念 //swift结构体比OC C语言里面的结构体更加进了一步,里面可以有方法, ...