1.Set存放的元素是无序的不可重复。
2.List存放的元素为有序可重复。
3.重写equals方法,一般最好重写hasCode方法,当对象作为key的时候及索引,会使用hasCode方法进行查找。
4.容器对象在调用remove,contains等方法时需要比较对象是否相等,这会涉及到对象类型的equals方法和
hashCode方法。对于自定义的类型,需要重写equals和has...
分类:
编程语言 时间:
2014-08-11 21:24:32
阅读次数:
273
对STL的优先队列,map,set的小总结,望指正。...
分类:
其他好文 时间:
2014-08-09 11:44:57
阅读次数:
269
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int main()
{
pair p;
p = make_pair(1,2) ;
pair p1(1,"sttttaa");...
分类:
编程语言 时间:
2014-08-04 11:09:07
阅读次数:
236
Description
On a m*m land stationed n troops, numbered from 1 to n. The i-th troop's position can be described by two numbers (xi,yi) (1
Then there are t minutes, in each minute one of the followi...
分类:
其他好文 时间:
2014-07-28 16:25:13
阅读次数:
356
List、Map和Set的实现类
1、List实现类
(1)ArrayList
(2)Vector
2、Map实现类
(1)HashMap
(2)Hashtable
3、Set实现类
(1)HashSet
(2)LinkedHashSet
(3)TreeSet
(4)EnumSet...
分类:
其他好文 时间:
2014-07-20 10:48:19
阅读次数:
185
Java中集合List,Map和Set的区别
1、List和Set的父接口是Collection,而Map不是
2、List中的元素是有序的,可以重复的
3、Map是Key-Value映射关系,且Key不能重复
4、Set中的元素是无序的,不可重复的...
分类:
编程语言 时间:
2014-07-20 10:37:19
阅读次数:
223
/**
* 功能:使用标准库:文本查询程序
* 时间:2014年7月10日09:10:15
* 作者:cutter_point
*/
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
using line_no=vector::size_type;
/**...
分类:
编程语言 时间:
2014-07-11 00:16:17
阅读次数:
305
1、面向对象中只有两样东西:类,对象。前者是“虚”,只有被实例化了,才是我们需要的“实”。
2、面向对象中的任何东西的表现形式,归根结底都是通过“类”表现出来的(接口也是一种类)。
3、定义类的同时就是在“封装”,只是封装的好坏不同;在不断的抽象,实现/继承的过程中,就是多态的体现;
4、Collection不要翻译成“集合”,就是Collection。有些东西翻译过来后悔影响理解。从本身属性的角度来说Collection包含:list,map,set ,容器;不要让“list=集合”存在脑中。...
分类:
其他好文 时间:
2014-07-09 09:46:28
阅读次数:
222
使用关联容器
两个主要的关联容器map和set
8个容器:(1)或者是一个set一个map;(2)或者要求不重复的关键字,或者允许重复关键字;
(3)按顺序保存元素,或无序保存。允许重复关键字的容器的名字中都包含单词multi;不
保持关键字按顺序存储的容器的名字都以单词unordered开头。
map类型常常被叫成关联容器,这个是关键...
分类:
编程语言 时间:
2014-06-25 07:05:53
阅读次数:
292