Advertisement
Guest User

Untitled

a guest
Jun 26th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. public class Solution {
  2.     public static final List<Person> PEOPLE = new ArrayList<Person>();
  3.  
  4.     public static void main(String[] args) throws IOException, ParseException
  5.     {
  6.         BufferedReader br = new BufferedReader(new FileReader(args[0]));
  7.         String line;
  8.  
  9.         SimpleDateFormat format = new SimpleDateFormat("dd mm yyyy");
  10.  
  11.         while((line = br.readLine()) != null) {
  12.  
  13.             String string = line.replaceAll("[a-zA-Zа-яА-Я]+", "").trim();
  14.             Date date = format.parse(string);
  15.  
  16.             String name = line.replaceAll("[\\d]+", "");
  17.             PEOPLE.add(new Person(name, date));
  18.         }
  19.  
  20.         for (int i = 0; i < PEOPLE.size(); i++)
  21.         {
  22.             System.out.println(PEOPLE.get(i).getName() + " " + format.format(PEOPLE.get(i).getBirthday()));
  23.         }
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement