year_2021/src/main/java/nl/mwensveen/adventofcode/year_2021/FileReadHelper.java
public static List<Long> readLinesAsLongs(String fileName) {
        URL url = Resources.getResource(fileName);
        List<String> lines;
        try {
            lines = Files.readLines(new File(url.getFile()), Charset.defaultCharset());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return lines.stream().map(s -> Long.valueOf(s)).collect(ImmutableList.toImmutableList());
    }
/**
     * Read lines of the file and return each line as integer.
     *
     * @param fileName the file name
     * @return an immutable list
     */
Read lines of the file and return each line as integer.
@param fileName the file name
@return an immutable list
Read lines of the file and return each line as integer . @param fileName the file name @return an immutable list
public static List<Long> readLinesAsLongs(String fileName) {
        URL url = Resources.getResource(fileName);
        List<String> lines;
        try {
            lines = Files.readLines(new File(url.getFile()), Charset.defaultCharset());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return lines.stream().map(s -> Long.valueOf(s)).collect(ImmutableList.toImmutableList());
    }
public static List < Long > readLinesAsLongs ( String fileName ) { URL url = Resources . getResource ( fileName ) ; List < String > lines ; try { lines = Files . readLines ( new File ( url . getFile ( ) ) , Charset . defaultCharset ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } return lines . stream ( ) . map ( s -> Long . valueOf ( s ) ) . collect ( ImmutableList . toImmutableList ( ) ) ; }
Read lines of the file and return each line as integer.
Read lines of the file and return each line as integer .