Есть ли способ реализовать двоичный поиск в ArrayList с объектами? В этом примере ArrayList будет сортироваться с полем "id".
class User{
public int id;
public string name;
}
ArrayList<User> users = new ArrayList<User>();
sortById(users);
int id = 66
User searchuser = getUserById(users,id);
Как будет выглядеть "User getUserById (пользователи ArrayList, int userid)", если я должен вернуть пользователя с указанным идентификатором, используя двоичный поиск? Возможно ли это?