public AStar(Node start, Node goal, boolean useOwnCollections) {

        if (useOwnCollections) {
            open = new PriorityQueue<>(new Comparator<Node>() {
                @Override
                public int compare(Node o1, Node o2) {

                    if (o2.getF(goalNode) < o1.getF(goalNode)) {
                        return -1;
                    }
                    if (o2.getF(goalNode) > o1.getF(goalNode)) {
                        return 1;
                    }
                    return 0;
                }
            });
            closed = new ArrayList<>();
            path = new ArrayList<>();
        } else {
            open = new java.util.PriorityQueue<>(10, new Comparator<Node>() {
                @Override
                public int compare(Node n1, Node n2) {

                    if (n2.getF(goalNode) < n1.getF(goalNode)) {
                        return 1;
                    }
                    if (n2.getF(goalNode) > n1.getF(goalNode)) {
                        return -1;
                    }
                    return 0;
                }
            });
            closed = new java.util.ArrayList<>();
            path = new java.util.ArrayList<>();
        }

        restart(start, goal);
    }