/**
* Returns an iterator over the lines in the string. If the string ends in a newline, a final
* empty string is not included, to match the behavior of BufferedReader/LineReader.readLine().
*/
private Iterator<String> linesIterator() {
return new AbstractIterator<String>() {
Iterator<String> lines = LINE_SPLITTER.split(seq).iterator();
@Override
protected String computeNext() {
if (lines.hasNext()) {
String next = lines.next();
// skip last line if it's empty
if (lines.hasNext() || !next.isEmpty()) {
return next;
}
}
return endOfData();
}
};
}
CharSource.java 文件源码
java
阅读 35
收藏 0
点赞 0
评论 0
项目:guava-mock
作者:
评论列表
文章目录