Results 1 to 1 of 1
  1. #1
    AdRock is offline Member
    Join Date
    Jan 2008
    Posts
    1
    Rep Power
    0

    Default name clash: equals(E) in and equals(java.lang.Object)

    I am getting this error but i don't know how to fix it

    name clash: equals(E) in and equals(java.lang.Object) in java.lang.Object have the same erasure, yet neither overrides the other
    I have created a generic sorted set and everything else works apart from the equals method which is in the comparator

    Here is the code in question
    Java Code:
    public Comparator<E> comparator(){
        
        	return new Comparator<E>() {
      	
                public int compare(E obj1, E obj2) {
                    Node<E> node1 = (Node) obj1;
        			Node<E> node2 = (Node) obj2;
                    
         			return node1.compareTo(node2.getContents());            
                }	
    
      			public boolean equals(E obj) {            	         	
            		if (!(obj instanceof OrderedLinkedList)) {
                        return false;
            		}
    
            		Node<E> newNode = (Node) obj;
            		return current.getContents().equals(newNode.getContents());
            	}
        	};
        }
    I have included the files to create the sorted set. I have a Node class which creates a node object and the linked list class which implements the SortedSet interface with all of the methods overwritten
    Attached Files Attached Files

Similar Threads

  1. Replies: 2
    Last Post: 11-26-2010, 03:12 AM
  2. java.lang.OutOfMemoryError: Java heap space
    By paul in forum Advanced Java
    Replies: 11
    Last Post: 06-12-2010, 06:30 PM
  3. Replies: 3
    Last Post: 09-07-2009, 02:28 PM
  4. Replies: 2
    Last Post: 09-18-2008, 08:30 AM
  5. java.lang.OutOfMemoryError with java vector
    By mary in forum New To Java
    Replies: 3
    Last Post: 08-03-2007, 11:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •