title: How can I check if an Element in my Lists points to my current element?
body: <p>I'm working on a programming exercise, and I stumbled across a problem about &quot;comparing&quot; List objects for a method.</p>
  <p>Goal: Check if the previous object in the List is null or if its next attributes points at my current object.</p>
  <p>My idea was the following:</p>
  <pre><code>public ListElement (String info, ListElement next, ListElement prev) {
      this.info = info;
      this.next = next;
      this.prev = prev;
  }
  
  public boolean isDeleted() {
      ListElement prevElement = getPrev();
      ListElement nextElement = getNext();
  
      if(prevElement.next.info.equals(this.info))
          return false;
  }
  </code></pre>
  <p>However, I'm not sure if I get the correct result / about the approach.
  Is there a better way to do this?</p>