@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true; // If o points to the same position in memory as this list, they must be equal
		}
		
		if  (o instanceof DLList) { // Check if o is a doubly linked list
			DLList<E> other = (DLList<E>) o; // Cast o to a DLList<E> so that we can access the data inside

			Node ptr1 = this.head; // ptr1 keeps track of each element inside this list
			Node ptr2 = other.head; // ptr2 is a reference to the elements of the other list

			for (; ptr1 != null && ptr2 != null; ptr1 = ptr1.next, ptr2 = ptr2.next) {
				if (!(ptr1.data.equals(ptr2.data))) {
					return false;
				}
			} // Go through each element in both lists until one of the elements is not equal to the other or either of the lists end up at the end

			return true; // If the code reaches here the lists must be equal
		}

		return false; // If the code made it here, o can't be a DLList which implies this.equals(o) must be false.
	}