class PathUtils {

    public static boolean checkPathConnection(final List<Line> path) {
        if (path == null) {
            return true;
        }
        // / check whether the subsequent line is in the list of successors
        int size = path.size();
        for (int i = 0; i < size - 1; ++i) {
            Line currentline = path.get(i);
            Line successorline = path.get(i + 1);
            Iterator<? extends Line> iter = currentline.getNextLines();
            boolean found = false;
            while (iter.hasNext()) { // iterate over all successor
                // test if it is the right one
                if (successorline.getID() == iter.next().getID()) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                return false; // no valid successor found!
            }
        }
        return true;
    }

    private  PathUtils();

}