day7日考
commit
06a8316897
|
@ -0,0 +1,8 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
|
@ -0,0 +1,36 @@
|
||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="INNER_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="METHOD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="FIELD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="IGNORE_DEPRECATED" value="false" />
|
||||||
|
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||||
|
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||||
|
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||||
|
<option name="myAdditionalJavadocTags" value="date" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/Zg6-day7.iml" filepath="$PROJECT_DIR$/Zg6-day7.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,79 @@
|
||||||
|
package com.zt.pojo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:张腾
|
||||||
|
* @Package:com.zt.pojo
|
||||||
|
* @Project:Zg6-day7
|
||||||
|
* @name:Student
|
||||||
|
* @Date:2024/7/25 8:37
|
||||||
|
*/
|
||||||
|
public class Student {
|
||||||
|
private Integer id;
|
||||||
|
private String name;
|
||||||
|
private Integer age;
|
||||||
|
private String sex;
|
||||||
|
private Integer scope;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Student{" +
|
||||||
|
"id=" + id +
|
||||||
|
", name='" + name + '\'' +
|
||||||
|
", age=" + age +
|
||||||
|
", sex='" + sex + '\'' +
|
||||||
|
", scope=" + scope +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public Student(Integer id, String name, Integer age, String sex, Integer scope) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.age = age;
|
||||||
|
this.sex = sex;
|
||||||
|
this.scope = scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Student() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getAge() {
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(Integer age) {
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSex() {
|
||||||
|
return sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSex(String sex) {
|
||||||
|
this.sex = sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getScope() {
|
||||||
|
return scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScope(Integer scope) {
|
||||||
|
this.scope = scope;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.zt.test;
|
||||||
|
|
||||||
|
import com.zt.pojo.Student;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:张腾
|
||||||
|
* @Package:com.zt.test
|
||||||
|
* @Project:Zg6-day7
|
||||||
|
* @name:StudentTest
|
||||||
|
* @Date:2024/7/25 8:39
|
||||||
|
*/
|
||||||
|
public class StudentTest {
|
||||||
|
|
||||||
|
static HashMap<Integer, Student> map = new HashMap<>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
Student zhSan = new Student(1,"张三", 19, "男", 89);
|
||||||
|
Student liSi = new Student(2,"李四", 23, "男", 98);
|
||||||
|
map.put(zhSan.getId(),zhSan);
|
||||||
|
map.put(liSi.getId(),liSi);
|
||||||
|
}
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("=====第一种方式=====");
|
||||||
|
map.forEach((integer, student) -> {
|
||||||
|
System.out.println("键:"+integer+"值:"+student);
|
||||||
|
});
|
||||||
|
|
||||||
|
System.out.println("=====第二种方式=====");
|
||||||
|
Set<Integer> integers = map.keySet();
|
||||||
|
for (Integer id : integers) {
|
||||||
|
Student student = map.get(id);
|
||||||
|
System.out.println("键:"+id+"值:"+student);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("=====第三种方式=====");
|
||||||
|
Set<Map.Entry<Integer, Student>> entries = map.entrySet();
|
||||||
|
for (Map.Entry<Integer, Student> entry : entries) {
|
||||||
|
Integer key = entry.getKey();
|
||||||
|
Student value = entry.getValue();
|
||||||
|
System.out.println("键:"+key+"值:"+value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue