I have an object TaskModel that contains a list of TaskItems. A swing interface shows the contents of the current item. The current item is indicated by currentTaskId. Clicking on a "next" button calls nextItem().
I want nextItem() to increment the value of currentTaskId by 1. Unless it causes an out of bounds error.
I dont like how nextItem() is written because I belive that taskItems.size() uses to many resources and the error ( out of bounds )isnt handled well.