Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Here's a pretty embarrassing one ;):

int index = 0; while (!element.equals(sortedList.get(index)) && sortedList.size() > ++index); return index < sortedList.size() ? index : -1;



Asking for the sortedList size with every iteration of that loop. haha, ouch! :)


that's the slowest subroutine I've ever seen


Thanks for sharing!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: