Results 1 to 1 of 1
- 01-25-2008, 11:13 PM #1
Member
- Join Date
- Jan 2008
- Posts
- 1
- Rep Power
- 0
name clash: equals(E) in and equals(java.lang.Object)
I am getting this error but i don't know how to fix it
I have created a generic sorted set and everything else works apart from the equals method which is in the comparatorname clash: equals(E) in and equals(java.lang.Object) in java.lang.Object have the same erasure, yet neither overrides the other
Here is the code in question
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 overwrittenJava 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()); } }; }
Similar Threads
-
Operator < cannot be applied to java.lang.Object, Object
By Albert in forum Advanced JavaReplies: 2Last Post: 11-26-2010, 02:12 AM -
java.lang.OutOfMemoryError: Java heap space
By paul in forum Advanced JavaReplies: 11Last Post: 06-12-2010, 05:30 PM -
java.lang.UnsatisfiedLinkError: no parport in java.library.path
By Heather in forum NetBeansReplies: 3Last Post: 09-07-2009, 01:28 PM -
Error: cannot resolve symbol' on Person (java.lang.String, java.lang.String)
By baltimore in forum New To JavaReplies: 2Last Post: 09-18-2008, 07:30 AM -
java.lang.OutOfMemoryError with java vector
By mary in forum New To JavaReplies: 3Last Post: 08-03-2007, 10:55 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks