riako8_8
commit
8611d8a0ab
|
@ -0,0 +1,38 @@
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AnalysisProjectProfileManager">
|
||||||
|
<option name="PROJECT_PROFILE" />
|
||||||
|
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
|
||||||
|
<list size="0" />
|
||||||
|
</component>
|
||||||
|
<component name="SuppressionsComponent">
|
||||||
|
<option name="suppComments" value="[]" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,8 @@
|
||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" native2AsciiForPropertiesFiles="true" defaultCharsetForPropertiesFiles="UTF-8">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="PROJECT" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CodeInsightWorkspaceSettings">
|
||||||
|
<option name="optimizeImportsOnTheFly" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
<component name="SuppressionsComponent">
|
||||||
|
<option name="suppComments" value="[]" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AnalysisProjectProfileManager">
|
||||||
|
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||||
|
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
|
||||||
|
<scopes />
|
||||||
|
<profiles>
|
||||||
|
<profile profile_name="Project Default" version="1.0" is_locked="false" />
|
||||||
|
</profiles>
|
||||||
|
<list size="0" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>rikao8_8</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.bwie;
|
||||||
|
|
||||||
|
import com.bwie.domain.Student;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
//TIP 要<b>运行</b>代码,请按 <shortcut actionId="Run"/> 或
|
||||||
|
// 点击装订区域中的 <icon src="AllIcons.Actions.Execute"/> 图标。
|
||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
//存入实体类中
|
||||||
|
//第一个
|
||||||
|
Student student = new Student();
|
||||||
|
student.setStudentId(1);
|
||||||
|
student.setStudentName("黑鬼");
|
||||||
|
student.setScore(30);
|
||||||
|
student.setClassName("语文");
|
||||||
|
|
||||||
|
String string=student.toString();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//第二个
|
||||||
|
Student student1= new Student();
|
||||||
|
student1.setStudentId(1);
|
||||||
|
student1.setStudentName("黑黑");
|
||||||
|
student1.setScore(30);
|
||||||
|
student1.setClassName("英语");
|
||||||
|
String string1=student1.toString();
|
||||||
|
|
||||||
|
//第三个
|
||||||
|
Student student2= new Student();
|
||||||
|
student2.setStudentId(1);
|
||||||
|
student2.setStudentName("黑黑");
|
||||||
|
student2.setScore(30);
|
||||||
|
student2.setClassName("数学");
|
||||||
|
String string2=student2.toString();
|
||||||
|
|
||||||
|
|
||||||
|
//第四个
|
||||||
|
Student student3= new Student();
|
||||||
|
student3.setStudentId(1);
|
||||||
|
student3.setStudentName("黑黑");
|
||||||
|
student3.setScore(30);
|
||||||
|
student3.setClassName("政治");
|
||||||
|
String string3=student3.toString();
|
||||||
|
|
||||||
|
|
||||||
|
//第五个
|
||||||
|
Student student4= new Student();
|
||||||
|
student4.setStudentId(1);
|
||||||
|
student4.setStudentName("黑黑");
|
||||||
|
student4.setScore(30);
|
||||||
|
student4.setClassName("英语");
|
||||||
|
String string4=student4.toString();
|
||||||
|
|
||||||
|
|
||||||
|
//都存入到集合中
|
||||||
|
List<String> stringList=new ArrayList<>();
|
||||||
|
stringList.add(string);
|
||||||
|
stringList.add(string1);
|
||||||
|
stringList.add(string2);
|
||||||
|
stringList.add(string3);
|
||||||
|
stringList.add(string4);
|
||||||
|
|
||||||
|
|
||||||
|
Stream<String> distinct = stringList.
|
||||||
|
stream().distinct();
|
||||||
|
System.out.println(distinct);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.bwie.domain;
|
||||||
|
|
||||||
|
public class Student {
|
||||||
|
private Integer studentId;
|
||||||
|
private String studentName;
|
||||||
|
private String className;
|
||||||
|
private Integer score;
|
||||||
|
|
||||||
|
public Student(Integer studentId, String studentName, String className, Integer score) {
|
||||||
|
this.studentId = studentId;
|
||||||
|
this.studentName = studentName;
|
||||||
|
this.className = className;
|
||||||
|
this.score = score;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Student() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStudentId() {
|
||||||
|
return studentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStudentId(Integer studentId) {
|
||||||
|
this.studentId = studentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStudentName() {
|
||||||
|
return studentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStudentName(String studentName) {
|
||||||
|
this.studentName = studentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClassName() {
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClassName(String className) {
|
||||||
|
this.className = className;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getScore() {
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScore(Integer score) {
|
||||||
|
this.score = score;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Student{" +
|
||||||
|
"," + studentId +
|
||||||
|
",'" + studentName + '\'' +
|
||||||
|
"," + className + '\'' +
|
||||||
|
"," + score +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue