collectionclasstest.java

来自「这是一个关于J2EE的开源包common里的许多组件的示例应用程序,可以借鉴.」· Java 代码 · 共 66 行

JAVA
66
字号
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 + =
减小字号Ctrl + -
显示快捷键?