Skip to content

Commit f7dd7eb

Browse files
committed
Day092
1 parent e2c5951 commit f7dd7eb

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

README.adoc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3497,4 +3497,23 @@ public class Day091 {
34973497
System.out.println(distinctElementsList);
34983498
}
34993499
}
3500+
----
3501+
3502+
== Day 92 - Summing the elements of a `List`.
3503+
[source,java]
3504+
----
3505+
package com.thegreatapi.ahundreddaysofjava.day092;
3506+
3507+
import java.util.List;
3508+
3509+
public class Day092 {
3510+
3511+
public static void main(String[] args) {
3512+
List<Integer> integers = List.of(1, 2, 3, 4, 5);
3513+
3514+
Integer sum = integers.stream().mapToInt(Integer::intValue).sum();
3515+
3516+
System.out.println(sum);
3517+
}
3518+
}
35003519
----

days/day092/pom.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>days</artifactId>
7+
<groupId>com.thegreatapi.100daysofjava</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>day092</artifactId>
13+
14+
<properties>
15+
<maven.compiler.source>16</maven.compiler.source>
16+
<maven.compiler.target>16</maven.compiler.target>
17+
</properties>
18+
19+
</project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.thegreatapi.ahundreddaysofjava.day092;
2+
3+
import java.util.List;
4+
5+
public class Day092 {
6+
7+
public static void main(String[] args) {
8+
List<Integer> integers = List.of(1, 2, 3, 4, 5);
9+
10+
Integer sum = integers.stream().mapToInt(Integer::intValue).sum();
11+
12+
System.out.println(sum);
13+
}
14+
}

days/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
<module>day089</module>
103103
<module>day090</module>
104104
<module>day091</module>
105+
<module>day092</module>
105106
</modules>
106107

107108
</project>

0 commit comments

Comments
 (0)