class PathUtils {

    public static Line findCommonLineInPaths(final List<? extends Line> location,
                                             final LineLinkedListElement el) {
        Line line = null;
        LineLinkedListElement current = el;
        if (location != null && current != null && current.getLine() != null) {
            if (location.contains(current.getLine())) {
                line = current.getLine();
            } else {
                while (current.getPrevious() != null) {
                    current = current.getPrevious();
                    if (location.contains(current.getLine())) {
                        line = current.getLine();
                        break;
                    }
                }
            }
        }
        return line;
    }

    private  PathUtils();

}