Java Reference
In-Depth Information
String newWord = word;
executor.submit(() ->
System.out.println("New word: " + newWord));
wordId = rs.getInt(1);
rs.close();
wordMap.put(word, wordId);
}
createLineWord.setInt(1, lineId);
createLineWord.setInt(2, wordId);
createLineWord.setInt(3, wordOffset);
boolean createdLineWord = createLineWord.executeUpdate() == 1;
assert createdLineWord : "Could not create line-word";
}
}
}
}
} finally {
executor.shutdown();
executor.awaitTermination(1L, TimeUnit.MINUTES);
}
}
/**
* Returns the next
*/
public static String nextLine(BufferedReader reader) throws IOException {
String line;
while ((line = reader.readLine()) != null) {
line = BAD_CHARS.matcher(line).replaceAll("");
line = line.trim();
if (line.isEmpty() || IS_WHITESPACE.test(line)) {
continue;
} else {
break;
}
}
return line;
}
private static int doCreateBook(
PreparedStatement createBook, String title, int year,
ExecutorService executor
) throws SQLException {
createBook.setString(1, title);
createBook.setInt(2, year);
boolean createdBook = createBook.executeUpdate() == 1;
assert createdBook : "Could not create book";
ResultSet rs = createBook.getGeneratedKeys();
boolean hasNext = rs.next();
Search WWH ::




Custom Search