private static TaskEntity getTask ( final int taskId , final Collection < TaskEntity > tasks ) { for ( final TaskEntity task : tasks ) { if ( taskId == task . getId ( ) ) { return task ; } } return null ; }
Iterate over the collection to find a TaskEntity with ID .