class PathUtils {

    public static List<Line> constructPath(final LineLinkedListElement dest) {
        ArrayList<Line> path = new ArrayList<Line>();
        if (dest != null) {
            path.add(dest.getLine());
            LineLinkedListElement akt = dest;
            while (akt.getPrevious() != null) {
                akt = akt.getPrevious();
                if (path.contains(akt.getLine())) {
                    return null;
                }
                path.add(0, akt.getLine());
            }
        }
        return path;
    }

    private  PathUtils();

}