📄 collectionclasstest.java
字号:
package collections;
import java.util.Collections;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
/**
* Title : Base Dict Class
* Description : here Description is the function of class, here maybe multirows
* @author <a href="mailto:sunpeng@china.freeborders">kevin</a>
* @Version 1.0
*/
/**
* Class description goes here.
* @version 1.0 2005-8-30
* @author kevin
*/
public class CollectionClassTest
{
/**
* 查看HashMap与Hashtable的区别.
*
*/
public void testMap()
{
HashMap map = new HashMap();
map.put(null, "HashMap key value.");
System.out.println((String)map.get(null));
Hashtable table = new Hashtable();
table.put("test", "Hashtable key value.");
System.out.println((String)table.get("test"));
}
/**
* 区别Collections与Collection.
*
*/
public void testConllections()
{
HashMap map = new HashMap();
map.put(null, "HashMap key value.");
Map map2 = Collections.unmodifiableMap(map);
map2.put(null, "HashMap key value.");
//assert(map2==null);
System.out.println((String)map2.get(null));
}
public void testAssert()
{
boolean sign = false;
//assert(sign==true);
}
public static void main(String[] args)
{
CollectionClassTest test = new CollectionClassTest();
//test.testMap();
//test.testConllections();
test.testAssert();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -