Example #1
0
  // returns a string will all values from list
  public String toString() {
    String output = "";
    HistoNode toCopy = front;
    while (toCopy.getNext() != null) {
      output += toCopy.getLetter() + " - " + toCopy.getLetterCount() + " ";
      toCopy = toCopy.getNext();
    }

    return output;
  }
Example #2
0
 // returns the index pos of let in the list if let exists
 public int indexOf(char let) {
   int count = 0;
   HistoNode copy = front;
   while (copy != null) {
     if (copy.getLetter() == let) {
       return count;
     } else {
       copy = copy.getNext();
       count++;
     }
   }
   return -1;
 }