/**
  * Add a collection of IDs. The IDs are copied into the builder, not referenced.
  *
  * @param ids The IDs to add.
  * @return The builder (for chaining)
  */
 public ScoredIdListBuilder addAll(Iterable<ScoredId> ids) {
   Preconditions.checkState(ids != null, "builder has been finished");
   // fast iteration is safe since add() doesn't retain the id object
   for (ScoredId id : CollectionUtils.fast(ids)) {
     add(id);
   }
   return this;
 }
  @Override
  public LongSet getUsersForItem(long item) {
    List<Event> events = getEventsForItem(item);
    if (events == null) {
      return null;
    }

    LongSet users = new LongOpenHashSet();
    for (Event evt : CollectionUtils.fast(events)) {
      users.add(evt.getUserId());
    }
    return users;
  }
 public void writeRatings(Iterable<? extends Rating> ratings) throws IOException {
   for (Rating r : CollectionUtils.fast(ratings)) {
     writeRating(r);
   }
 }