Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.*;
import java.util.*;
import java.util.logging.Logger;

public class Main {
    protected static Logger logger = Logger.getLogger("hopshackle.simulation");

    public static List<String> createListFromFile(File f) {
        List<String> retList = new ArrayList<String>();
        FileInputStream fis;
        BufferedReader br;
        try {
            fis = new FileInputStream(f);
            InputStreamReader isr = new InputStreamReader(fis);
            br = new BufferedReader(isr);

            String nStr;
            nStr = br.readLine();
            while (nStr != null) {
                retList.add(nStr);
                nStr = br.readLine();
            }

            br.close();
            fis.close();
        } catch (FileNotFoundException e) {
            logger.severe(e.toString());
            e.printStackTrace();
        } catch (IOException e) {
            logger.severe(e.toString());
            e.printStackTrace();
        }

        return retList;
    }
}