so I was revisiting some code that another user here sent me a few months back for reading a file.
public static List<List<Tile>> readMap(String path) throws IOException {
try (Stream<String> lines = Files.lines(Path.of("resources/maps/" + path + ".txt"))) {
return lines.map(s -> SPACE_PATTERN.splitAsStream(s).map(s_ -> new Tile(Integer.valueOf(s_))).toList()).toList();
}
}```
I wanted to change this to
```java
public static List<List<Tile>> readMap(String path) throws IOException {
try (Stream<String> lines = Files.lines(Path.of("resources/maps/" + path + ".txt"))) {
int i, j;
return lines.map(s -> {
i++;
SPACE_PATTERN.splitAsStream(s).map(s_ -> {
new Tile(Integer.valueOf(s_), i * Main.tileSize, j * Main.tileSize); // 2nd and 3rd paramater is x and y coord
}).toList();
}).toList();
}
}``` but for some reason, even though being pretty much the exact same thing, .map() throws these errors.
Any idea why this may be?
