コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
  @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;
  }
コード例 #3
0
ファイル: SparseVectorMap.java プロジェクト: hqmshhxx/lenskit
 @Override
 public ObjectCollection<Double> values() {
   return CollectionUtils.objectCollection(vector.values());
 }
コード例 #4
0
 public void writeRatings(Iterable<? extends Rating> ratings) throws IOException {
   for (Rating r : CollectionUtils.fast(ratings)) {
     writeRating(r);
   }
 }