MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / FileInputSupplier

Method FileInputSupplier

enums/VendingMachine.java:132–143  ·  view source on GitHub ↗
(String fileName)

Source from the content-addressed store, hash-verified

130class FileInputSupplier implements Supplier<Input> {
131 private Iterator<String> input;
132 FileInputSupplier(String fileName) {
133 try {
134 input = Files.lines(Paths.get(fileName))
135 .skip(1) // Skip the comment line
136 .flatMap(s -> Arrays.stream(s.split(";")))
137 .map(String::trim)
138 .collect(Collectors.toList())
139 .iterator();
140 } catch(IOException e) {
141 throw new RuntimeException(e);
142 }
143 }
144 @Override public Input get() {
145 if(!input.hasNext())
146 return null;

Callers

nothing calls this directly

Calls 4

splitMethod · 0.80
getMethod · 0.65
iteratorMethod · 0.45
streamMethod · 0.45

Tested by

no test coverage detected