hashset存储对象,以及如何对相同对象不进行储存

package haxi;

import java.util.HashSet;

public class Hashset {

public static void main(String[] args) {
// TODO 自动生成的方法存根
HashSet s1 = new HashSet();
Student student1 = new Student("yyz", 18);
Student student2 = new Student("yyzz", 18);
Student student3 = new Student("yyzzz", 18);
Student student4 = new Student("yyz", 18);

s1.add(student1);
s1.add(student2);
s1.add(student3);

for (Student string : s1) {
Student s2 = string;
S

hashset存储对象,以及如何对相同对象不进行储存最先出现在Python成神之路

版权声明:
作者:Zad
链接:https://www.techfm.club/p/22000.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>