throw new IllegalArgumentException("userData is null");
}
this.preferenceFromUsers = userData;
this.preferenceForItems = new FastByIDMap<FastIDSet>();
FastIDSet itemIDSet = new FastIDSet();
for (Map.Entry<Long,FastIDSet> entry : preferenceFromUsers.entrySet()) {
long userID = entry.getKey();
FastIDSet itemIDs = entry.getValue();
itemIDSet.addAll(itemIDs);
LongPrimitiveIterator it = itemIDs.iterator();
while (it.hasNext()) {
long itemID = it.next();
FastIDSet userIDs = preferenceForItems.get(itemID);
if (userIDs == null) {
userIDs = new FastIDSet(2);
preferenceForItems.put(itemID, userIDs);
}
userIDs.add(userID);
}
}
this.itemIDs = itemIDSet.toArray();
itemIDSet = null; // Might help GC -- this is big