private static void stress(boolean withOwnCollections) {

        for (int l = 1; l <= loops; l++) {
            times = new ArrayList<>();

            for (int i = 1; i <= iterations; i++) {
                int width = widthFactor * i;
                int height = heightFactor * i;

                Grid grid = new Grid(width, height, AStar.Heuristics.MANHATTAN.getHeuristic());
                grid.generateNodes(true);

                Node startNode = grid.getNode(0, 0);
                Node goalNode = grid.getNode(width - 1, height - 1);

                AStar aStar = new AStar(startNode, goalNode, withOwnCollections);



                long startTime = System.nanoTime();

                while (true) {
                    if (aStar.evaluateNextStep()) {
                        break;
                    }
                }

                double millis = (System.nanoTime() - startTime) / 1000000.0;

                times.add(millis);
                System.out.println("i = " + i + ", WIDTH = " + width + ", HEIGHT = " + height + ", Time = " + millis + " ms");
            }

            try {
                File timeOutput = new File("time_output.txt");
                FileWriter fw = new FileWriter(timeOutput, true);

                if (indicesAppended == false) {
                    appendIndices(fw);
                }

                if (withOwnCollections) {
                    fw.append("own collection: ");
                } else {
                    fw.append("utils collection: ");
                }
                fw.append("time (ms):\t");
                for (int i = 0; i < times.size(); i++) {
                    fw.append(df.format(times.get(i)) + "\t");
                }

                if (l == loops) {
                    fw.append(System.getProperty("line.separator"));
                }
                fw.append(System.getProperty("line.separator"));
                fw.close();
            } catch (IOException ex) {
                Logger.getLogger(StressTest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }