Ciao a tutti,
qualcuno sa dirmi dove sbaglio?
codice:
private void insertSorted( Object i ) {
if ( first == null ) {
// initial list is empty
first = new ObjectListElem( i, null );
} else {
// initial list has at least one element
if ( compare(i,first.value) < 0 ) {
// add as first
addFirst( i );
} else {
// add someplace after the first
ObjectListElem elem = first;
while ( elem.next != null ) {
if ( compare(i,elem.next.value) < 0 ) {
// insert between e and e.next
elem.next = new ObjectListElem( i, elem.next );
return;
}
elem = elem.next;
} // end while()
// end of list reached and not yet inserted: add last
addLast( i );
}
}
} // end insertSorted()
} // end class ObjectList
L'errore che mi da il compilatore è
codice:
docking-hg-48-181-dhcp:~/Desktop matteo$ javac ObjectList.java
ObjectList.java:211: cannot find symbol
symbol : method compare(java.lang.Object,java.lang.Object)
location: class ObjectList
if ( compare(i,first.value) < 0 ) {
^
ObjectList.java:218: cannot find symbol
symbol : method compare(java.lang.Object,java.lang.Object)
location: class ObjectList
if ( compare(i,elem.next.value) < 0 ) {
^
2 errors
Grazie