public boolean equals(final Object object) { if (object == this) { return true; } if (object == null || !(object instanceof LinkedList)) { return false; } final LinkedList other = (LinkedList) object; if (this.size() != other.size()) { return false; } for (LinkedListNode thisNode = this.firstNode, otherNode = other.firstNode; thisNode != null && otherNode != null; thisNode = thisNode.getNext(), otherNode = otherNode.getNext()) { if (!thisNode.equals(otherNode)) { return false; } } return true; }