package iterator;
public class FileLineList extends AbstractList<String> {
if (!f.canRead()) {
}
}
public String get
(int index
) { try {
Init();
int count = 0;
while ((line = reader.readLine()) != null) {
if (index == count++) {
return line;
}
}
reader.close();
WriteReadingError();
}
return null;
}
public int size() {
int count = 0;
try {
Init();
while (reader.readLine() != null) count++;
reader.close();
WriteReadingError();
}
return count;
}
)
);
}
protected void WriteReadingError() {
System.
out.
println("Ошибка чтения файла: " + f.
getAbsolutePath() +
"!");
}
}