Advertisement
Guest User

javatest

a guest
May 26th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.18 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package randomclassnamegenerator;
  7.  
  8. import java.io.File;
  9. import java.util.ArrayList;
  10. import java.util.Arrays;
  11. import java.util.List;
  12. import java.util.Scanner;
  13.  
  14. /**
  15.  *
  16.  * @author yamitatsu
  17.  */
  18. public class RandomClassNameGenerator {
  19.  
  20.     static List<String> fileA = new ArrayList<String>();
  21.  
  22.     /**
  23.      * @param args the command line arguments
  24.      * @throws java.lang.Throwable
  25.      */
  26.     public static void main(String[] args) throws Throwable {
  27.         // TODO code application logic here
  28.         fileA = loadData("/home/yamitatsu/Téléchargements/Wget/fileA.txt");
  29.         System.out.println(fileA);
  30.     }
  31.  
  32.     private static List loadData(String fileName) throws Throwable {
  33.         List<String> fileContent = new ArrayList<String>();
  34.         File file = new File(fileName);
  35.         Scanner scanner = new Scanner(file).useDelimiter("\\Z");
  36.         String contents = scanner.next();
  37.         fileContent = Arrays.asList(contents.split(" "));
  38.         return fileContent;
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement