as i studied your code acc to me your max method will also not work for every case.
if(size() == 1){
return compare.getItem();
}else if(size() >= 1){
while(compare.next() != null){
if(compare.next().getItem() > compare.getItem() || compare.next().getItem() == compare.getItem()){
compare = compare.next();
}
}
why you are writing size()>
=1
your above condition is already checking for
size==1.
while(compare.next() != null){
if(compare.next().getItem() > compare.getItem() || compare.next().getItem() == compare.getItem()){
compare = compare.next();
}
whether it will move further if the element at next is smaller than the current.
try this input for your max function
2,23,34,32,11
Hope you will got the right path , where i want to direct you.