// Path: src/main/java/net/seninp/util/StackTrace.java
// public final class StackTrace {
// 
//   /** Disable public constructor. */
//   private StackTrace() {
//     // do nothing
//   }
// 
//   /**
//    * Converts the Throwable.getStackTrace to a String representation for logging.
//    * 
//    * @param throwable The Throwable exception.
//    * @return A String containing the StackTrace.
//    */
//   public static String toString(Throwable throwable) {
//     StringWriter stringWriter = new StringWriter();
//     throwable.printStackTrace(new PrintWriter(stringWriter));
//     return stringWriter.toString();
//   }
// }


import java.util.Comparator;
import java.util.Iterator;
import java.util.NoSuchElementException;
import net.seninp.util.StackTrace;
    public MyIterator(DoublyLinkedSortedList<T> doublyLinkedSortedList) {
      this.list = doublyLinkedSortedList;
    }

    @Override
    public boolean hasNext() {
      if (null == this.current) {
        if (this.list.isEmpty()) {
          return false;
        }
        return true;
      }
      if (null == this.current.next) {
        return false;
      }
      return true;
    }

    @Override
    public T next() {
      try {
        if (null == current) {
          current = this.list.first;
          return current.data;
        }
        current = current.next;
        return current.data;
      }
      catch (Exception e) {
        throw new NoSuchElementException(
// Path: src/main/java/net/seninp/util/StackTrace.java
// public final class StackTrace {
// 
//   /** Disable public constructor. */
//   private StackTrace() {
//     // do nothing
//   }
// 
//   /**
//    * Converts the Throwable.getStackTrace to a String representation for logging.
//    * 
//    * @param throwable The Throwable exception.
//    * @return A String containing the StackTrace.
//    */
//   public static String toString(Throwable throwable) {
//     StringWriter stringWriter = new StringWriter();
//     throwable.printStackTrace(new PrintWriter(stringWriter));
//     return stringWriter.toString();
//   }
// }


// Path: src/main/java/net/seninp/jmotif/sax/datastructure/DoublyLinkedSortedList.java
import java.util.Comparator;
import java.util.Iterator;
import java.util.NoSuchElementException;
import net.seninp.util.StackTrace;

    public MyIterator(DoublyLinkedSortedList<T> doublyLinkedSortedList) {
      this.list = doublyLinkedSortedList;
    }

    @Override
    public boolean hasNext() {
      if (null == this.current) {
        if (this.list.isEmpty()) {
          return false;
        }
        return true;
      }
      if (null == this.current.next) {
        return false;
      }
      return true;
    }

    @Override
    public T next() {
      try {
        if (null == current) {
          current = this.list.first;
          return current.data;
        }
        current = current.next;
        return current.data;
      }
      catch (Exception e) {
        throw new NoSuchElementException(
            "There was an exception thrown: " + StackTrace.toString(e));