Skip to content

Commit

Permalink
feat(objectionary#329): fix bug with CheckCast parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Jul 11, 2024
1 parent 9a930f9 commit 72d4a11
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 251 deletions.
12 changes: 6 additions & 6 deletions src/it/streams/src/main/java/org/eolang/streams/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@

public class Main {
public static void main(String... args) {
long start = System.currentTimeMillis();
// long start = System.currentTimeMillis();
String[] strings = IntStream.range(0, 10)
.mapToObj(i -> String.valueOf(i))
.toArray(String[]::new);
int sum = Arrays.stream(strings)
.filter(s -> Boolean.valueOf(s.equals("")).equals(false))
.mapToInt(s -> Integer.parseInt(s))
.sum();
System.out.printf("sum=%d time=%d\n", sum, System.currentTimeMillis() - start);
// int sum = Arrays.stream(strings)
// .filter(s -> Boolean.valueOf(s.equals("")).equals(false))
// .mapToInt(s -> Integer.parseInt(s))
// .sum();
// System.out.printf("sum=%d time=%d\n", sum, System.currentTimeMillis() - start);
}
}
3 changes: 1 addition & 2 deletions src/main/java/org/eolang/opeo/ast/CheckCast.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ public CheckCast(final XmlNode node, final Parser parser) {

private static AstNode xvalue(final XmlNode node, final Parser parser) {
return parser.parse(
node.children().findFirst()
.orElseThrow(() -> new IllegalArgumentException("CheckCast should have a child."))
node.children().collect(Collectors.toList()).get(1)
);
}

Expand Down
Loading

0 comments on commit 72d4a11

Please sign in to comment.