Make your Iterator UserId type (specify the type), ie
Iterator itr = details.iterator();
Because if you don't specify the type, how will it understand what to return. So for generalized purpose it will return Object type and thats why downcasting is required.