Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
558 B
2
Indexable
Never
public static void main(String[] args) throws Exception{

		// On découpe en 10 morceaux
		List<Chunk> chunks = FileSplitter.getChunks(fileName, 10);
		long debut = System.currentTimeMillis();
		Long r = Stream.of(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
				.parallel()
				.map(i -> new ChunkReaderCallable(fileName, chunks.get(i), word))
				.map(x -> x.call())
				.reduce(0L, Long::sum);
	}

 public ChunkReaderCallable(String fn, Chunk c, String w) throws IOException {
        this.r = new RandomAccessFile(fn,"r");
        this.c = c;
        this.w = w;
    }
Leave a Comment