title: Creating a genealogical tree java
body: <p>I have the following structure:</p>
  
  <pre><code>Member {
      String firstName;
      String secondName;
      Member[] children;
      Member father;
  }
  </code></pre>
  
  <ul>
  <li>I have to implement this tree in java;</li>
  <li>I have a first name and a second name of a member. I need to find the way from root to that node. 
  Can someone help me, please? </li>
  </ul>
  
  <p>This is what i have: </p>
  
  <p>public class Member {</p>
  
  <pre><code>public List&lt;Member&gt; children = new ArrayList&lt;&gt;();
  public Member father = null;
  public String secondName = null;
  public String firstName = null;
  
  public Member(String secondName, String firstName) {
      this.secondName = secondName;
      this.firstName = firstName;
  }
  
  public Member(String secondName, String firstName, Member father) {
      this.secondName = secondName;
      this.firstName = firstName;
      this.father = father;
  }
  
  public List&lt;Member&gt; getChildren() {
      return children;
  }
  
  public void setFather(Member father) {
      this.father = father;
      father.addChild(this);
  
  }
  
  public void addChild(String secondName, String firstName) {
      Member child = new Member(secondName, firstName);
      child.setFather(this);
      this.children.add(child);
  }
  
  public void addChild(Member child) {
      child.setFather(this);
      this.children.add(child);
  }
  
  public String getSecondName() {
      return this.secondName;
  }
  
  public String getFirstName() {
      return this.firstName;
  }
  
  public void setSecondName(String secondName) {
      this.secondName = secondName;
  }
  
  public void setPrenume(String firstName) {
      this.firstName = firstName;
  }
  
  public boolean isRoot() {
      return (this.father == null);
  }
  
  public void deleteFather() {
      this.father = null;
  }
  </code></pre>
  
  <p>}</p>