⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hashsetuse.java

📁 JAVA编程思想源代码 值得一下 很难找的
💻 JAVA
字号:
package chapter9;

import java.util.*;

public class HashSetUse {

	public static void main(String[] args) {

		HashSet s = new HashSet();

		Character chars = new Character('C');
		System.out.println("chars hasCode is:" + chars.hashCode());
		s.add(chars);

		String s1 = new String("hello");
		System.out.println("s1 hasCode is:" + s1.hashCode());
		s.add(s1);

		String s2 = new String("World");
		System.out.println("s2 hasCode is:" + s2.hashCode());
		s.add(s2);

		Integer itn = new Integer(23);
		System.out.println("itn hasCode is:" + itn.hashCode());
		s.add(itn);

		Double dou = new Double(33.33);
		System.out.println("dou hasCode is:" + dou.hashCode());
		s.add(dou);

		s.add(null);

		Iterator iter = s.iterator();
		System.out.println("begin: ");
		while (iter.hasNext()) {
			System.out.println(iter.next() + ", ");

		}
		System.out.println("end. ");
		System.out.println("the word 'world in s is :'" + s.contains("World"));
		System.out.println(s.hashCode());
		s.remove('C');

		iter = s.iterator();
		System.out.println("begin: ");
		while (iter.hasNext()) {
			System.out.println(iter.next() + ", ");

		}
		System.out.println("end. ");

	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -