package fr.umlv.poo.tpnote4.v0;

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;

public class Main {
  private static void processFile(FullIndex index, Path path) throws IOException {
    Files.lines(path, Charset.defaultCharset()).forEach(line -> {
      String[] words = line.split(" ");
      Arrays.stream(words).forEach(w -> index.add(path, w));
    });
  }
  
	public static void main(String[] args) throws IOException {
		FullIndex index = new FullIndex();
		processFile(index, Paths.get("data.txt"));		
		processFile(index, Paths.get("data2.txt"));		
		System.out.println(index);
	}
}
