package org.example.non.stream;

import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Collectors;

public class StreamPlayer
{

	public static void main(String[] args) throws Exception
	{
		// this is an example of read a text file using Streams
		
		String fileName = "ISOCountryCodes.txt";
		
		
		List<String> data = Files.lines(Paths.get(fileName))
		   .filter(line -> line.startsWith("T"))
		   .limit(3)
		   .map(s -> s.substring(0,3))
		   .map(String::toLowerCase)		   
		   .collect(Collectors.toList());
		
		System.out.println(data.size());

	}

}
