容器常用用法整理

2018-12-16  本文已影响0人  奥雷里亚诺下划线_上校

list容器
List it = new xxxList();
//增加
it.add();
//删除
it.remove(index);
//子容器
list2.subList(1,2);
//迭代器
Iterator it=ts.iterator();
if(it.hasNext()){
it.next();
}
//包含
list2.contains(2)

Set容器
Set it = new xxxSet();
类似list

Map容器
//增加.put(key,walue)
ma.put(1,1);
//删除
ma.remove(key);
//获得元素
ma.get(key)

上一篇 下一篇

猜你喜欢

热点阅读