package ru.pravvich.parseFile;

import java.util.*;

public class PrintOrders {
    private Sort sort;

    public List<Order> initDataStructure(String path) {
        Input input = new InputFile(path);
        Collection<Order> allOrders = input.readFile();

        sort = new SortData();
        Collection<Collection<Order>> collectionCollection =
                sort.getCollectionOfCollectionsByBook(allOrders);

        Collection<Order> mergedOrders =
                sort.mergeEachBook(collectionCollection);

        return sort.automaticDeals(new ArrayList<>(mergedOrders));
    }

    public void print(String book, String operation) {
        sort.getSortedByPriceCollectionBooksWith(book, operation)
                .forEach(System.out::println);
    }

    public void start() {
        print("book-1", "BUY");
        print("book-1", "SELL");
        System.out.println();
        print("book-2", "BUY");
        print("book-2", "SELL");
        System.out.println();
        print("book-3", "BUY");
        print("book-3", "SELL");
    }

    public static void main(String[] args) {
        PrintOrders printOrders = new PrintOrders();
        printOrders.initDataStructure("/Users/pavel/Desktop/orders.xml");
        printOrders.start();
    }
}

@@ -208,53 +208,196 @@
     
-Collection%3COrder%3E allOrders = input.readFile(
+long start = System.currentTimeMillis();%0A        Collection%3COrder%3E allOrders = input.readFile();%0A        long finish = System.currentTimeMillis();%0A        System.out.println(finish - start
 );%0A%0A
@@ -423,24 +423,25 @@
 SortData();%0A
+%0A
         Coll
@@ -489,16 +489,16 @@
 ction =%0A
-
         
@@ -552,24 +552,26 @@
 llOrders);%0A%0A
+%0A%0A
         Coll
@@ -1236,24 +1236,73 @@
 g%5B%5D args) %7B%0A
+        long start = System.currentTimeMillis();%0A
         Prin
@@ -1441,20 +1441,114 @@
 rs.start();%0A
+        long finish = System.currentTimeMillis();%0A        System.out.println(finish - start);%0A
     %7D%0A%7D%0A

add parser file