Hello
I have this code and it's work fine :
I want change BufferedReader readline() by read() because it's more faster! Someone can help please !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 try { bufferedReader = new BufferedReader(new FileReader(new File(filePath))); String currentLine; int numLine = 0; while ((currentLine = bufferedReader.readLine()) != null) { numLine++; for (String word : currentLine.split(" ")) { if (!word.isEmpty() ) { mapAllWordsPositionInFilesInFolder.computeIfAbsent(word,v -> new HashMap<>()) .computeIfAbsent(filePath, val -> new HashSet<>()) .add(numLine); } } } } catch (IOException e) { e.printStackTrace(); } finally { if (bufferedReader != null) { bufferedReader.close(); } }
Partager