Skip to content

Commit

Permalink
feat(objectionary#329): make 'streams' test pass
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Jul 9, 2024
1 parent 0d04ba7 commit 491fece
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/it/streams/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ SOFTWARE.
<configuration>
<sourcesDir>${project.build.directory}/generated-sources/jeo-decompile-xmir</sourcesDir>
<outputDir>${project.build.directory}/generated-sources/opeo-decompile-xmir</outputDir>
<modifiedDir>${project.build.directory}/generated-sources/opeo-decompile-modified-xmir</modifiedDir>
</configuration>
</execution>
<execution>
Expand Down
13 changes: 9 additions & 4 deletions src/it/streams/src/main/java/org/eolang/streams/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,19 @@
*/
package org.eolang.streams;

import java.util.Arrays;

public class Main {
public static void main(String... args) {
long total = Long.parseLong(args[0]);
long sum = 0L;
long start = System.currentTimeMillis();
for (long i = 0; i < total; ++i) {
sum += new A(42).get();
String[] strings = new String[10];
for (int i = 0; i < strings.length; i++) {
strings[i] = String.valueOf(i);
}
int sum = Arrays.stream(strings)
.filter(s -> !s.equals(""))
.mapToInt(s -> Integer.parseInt(s))
.sum();
System.out.printf("sum=%d time=%d\n", sum, System.currentTimeMillis() - start);
}
}

0 comments on commit 491fece

Please sign in to comment.