我正在尝试解析一个文本文件(file1.txt)
# ATown
# m
2 // this is var m
# Polynomials A
0 0 0 0 0 // the number of polynomials per section is m^2
0.20833 0 0 0 0 // the polynomials are always of degree 4
0 0.0333 -0.001388 0 0
0 0 0 0 0
# Polynomials B
0 0 0 0 0
0 0.048 -0.002 0 0
0.1428 0 0 0 0
0.0588 0 0 0 0空格分隔的数字表示多项式,应该在空格上拆分,并放入一个整数数组中,该数组应该放入各自的ArrayList中。
我想把2放到int m中,把多项式A放到ArrayList List<double []> polyA和List<double []> polyB中。
我想使用Streams API。
发布于 2017-06-28 17:03:47
Streams并不是为了回顾以前的元素而设计的,您需要以某种方式确定当前行是否表示多项式A或B的数量。
我建议您使用常规的for循环。
https://stackoverflow.com/questions/44798001
复制相似问题