Untitled

 avatar
unknown
plain_text
2 years ago
558 B
4
Indexable
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;
    }
Editor is loading...
Leave a Comment