1

I encountered following behavior when reading from a text file.

val input = new File(inputFileName);
val inp = input.openRead();
Console.OUT.println(inp.lines().next());
if (inp.lines().hasNext())
     Console.OUT.println(inp.lines().next());

my input file contains

0 1
0 2
0 3

As a result I get

0 1
0 3

It seems that inp.lines().hasNext() has moved the pointer forward and as a result one line is skipped in the text file. Is this a bug?

melpomene
  • 84,125
  • 8
  • 85
  • 148
Marina
  • 15
  • 4

1 Answers1

0

Yes, this looks like a bug. x10.io.FileReader.lines().hasNext() should not be skipping forward in the text file. Could you please raise an issue in the X10 JIRA project?

Josh Milthorpe
  • 956
  • 1
  • 14
  • 27