コード例 #1
0
    public boolean hayAnterior() {
      boolean hayAnterior = false;

      if (nodoActual != null) hayAnterior = nodoActual.darAnterior() != null;
      else if (ultimo != null) hayAnterior = true;

      return hayAnterior;
    }
コード例 #2
0
    public T darAnterior() {
      T elemento = null;

      if (hayAnterior()) {
        if (nodoActual != null) {
          nodoActual = nodoActual.darAnterior();
          elemento = nodoActual.darElemento();
        } else if (ultimo != null) {
          nodoActual = ultimo;
          elemento = nodoActual.darElemento();
        }
      }

      return elemento;
    }