package org.roi.itlab.cassandra;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * Created by mkuperman on 2/7/2017.
 */
public class PoiLoader {

    private PoiLoader() {
    }

    public static List<Poi> loadFromCsv(String filename) throws IOException {
        final Function<String, Poi> mapToPoi = line -> {
            String[] p = line.split("\\|");
            return new Poi(p[1], p[4], Integer.parseInt(p[0]), Double.parseDouble(p[2]), Double.parseDouble(p[3]));
        };

        return Files.lines(Paths.get(filename)).map(mapToPoi)
                .collect(Collectors.toList());

    }

}

@@ -303,21 +303,16 @@
 ader() %7B
-%0A    
 %7D%0A%0A    p

change constructor