title: How to display elements in a Linked list by recursion?
body: <p>Hello this is my linked list without implementing java.util.linkedlist</p>
  
  <p>I'd like to create a method that display recursively all of the elements in my linked list but I have no idea how to, my method doesn't have any parameters so I don't know how to get to the next value when calling the method itself</p>
  
  <pre><code>    public class Pokemon {
          private String name;
          private String type;
          private int niveau;
  
          public Pokemon(String name, String type) {
              this.name = name;
              this.type = type;
              this.niveau = (int) (Math.random() * (1 * 1 - 100) + 100);
          }
          public void display() {
              System.out.println(this.name);
         }
  
      public class Trainer {
  
          public final String name;
          private Pokeball head;
  
          public Trainer(String name) {
              this.name = name;
          }
  
          public void addPokemon(Pokemon pok) {
              if (this.head != null) {
                  this.head.addPokemon(pok);
              } else {
                  this.head = new Pokeball(pok);
              }
          }
  
         public void display() {
              if (this.head == null)
          return;
      else {
          this.head.display();
      }
  
  
      }
  
      public class Pokeball {
  
          private Pokemon pok;
          private Pokeball next;
  
          public Pokeball(Pokemon pok) {
              this.pok = pok;
          }
  
          public Pokeball(Pokemon pok, Pokeball next) {
              this.pok = pok;
              this.next = next;
          }
  
          public void addPokemon(Pokemon pok) {
              Pokeball current = this;
              while (current.next != null) {
                  current = current.next;
              }
              current.next = new Pokeball(pok);
          }
  
  public void display() {
      Pokeball current = this;
      if (current.next == null){
          return;
      } else { 
          // ....
      }
  
  
      }
  </code></pre>