@Override
public Collection<User> getUserNeighborhood(Object userID) throws TasteException {
log.trace("Computing neighborhood around user ID '{}'", userID);
DataModel dataModel = getDataModel();
User theUser = dataModel.getUser(userID);
List<User> neighborhood = new ArrayList<User>();
Iterator<? extends User> users = dataModel.getUsers().iterator();
UserSimilarity userSimilarityImpl = getUserSimilarity();
while (users.hasNext()) {
User user = users.next();
if (sampleForUser() && !userID.equals(user.getID())) {
double theSimilarity = userSimilarityImpl.userSimilarity(theUser, user);
if (!Double.isNaN(theSimilarity) && theSimilarity >= threshold) {
neighborhood.add(user);
}
}