master
张腾 2024-08-08 09:11:49 +08:00
commit 71046e9b83
9 changed files with 166 additions and 0 deletions

8
.idea/.gitignore vendored 100644
View File

@ -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/

View File

@ -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>

6
.idea/misc.xml 100644
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/zg6-day19.iml" filepath="$PROJECT_DIR$/zg6-day19.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,31 @@
package com.bwie.list;
import com.bwie.pojo.Student;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author
* @Packagecom.bwie.list
* @Projectzg6-day19
* @nameDemo01
* @Date2024/8/8 8:38
*/
public class Demo01 {
public static void main(String[] args) {
List<Student> list = new ArrayList<>();
list.add(new Student(1,"张三","语文",89.5));
list.add(new Student(2,"张三","数学",90.0));
list.add(new Student(3,"李四","语文",88.5));
list.add(new Student(4,"李四","数学",68.0));
list.add(new Student(5,"王五","语文",78.0));
list.add(new Student(6,"王五","数学",98.0));
list.stream()
.collect(Collectors.groupingBy(Student::getName,
Collectors.averagingDouble(Student::getScore)))
.forEach((stu,score) -> System.out.println("姓名:"+stu+"平均分:"+score));
}
}

View File

@ -0,0 +1,66 @@
package com.bwie.pojo;
/**
* @Author
* @Packagecom.bwie.pojo
* @Projectzg6-day19
* @nameStudent
* @Date2024/8/8 8:39
*/
public class Student {
private Integer id;
private String name;
private String socket;
private Double score;
public Student(Integer id, String name, String socket, Double score) {
this.id = id;
this.name = name;
this.socket = socket;
this.score = score;
}
@Override
public String toString() {
return "编号:" + id +
", 姓名:" + name + '\'' +
", 科目:" + socket + '\'' +
", 分数:" + score;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSocket() {
return socket;
}
public void setSocket(String socket) {
this.socket = socket;
}
public Double getScore() {
return score;
}
public void setScore(Double score) {
this.score = score;
}
public Student() {
}
}

11
zg6-day19.iml 100644
View File

@ -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>