public final class Preferences extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
equals(Preference p1,
Preference p2)
Compare two preferences for equality.
|
static int |
hashPreference(Preference preference)
Compute the hash code of a preference.
|
static Preference |
make(long uid,
long iid,
double val)
Create a new preference.
|
static PreferenceBuilder |
newBuilder()
Construct a new preference builder.
|
static MutableSparseVector |
userPreferenceVector(Collection<? extends Preference> prefs)
Compute a user preference vector.
|
public static PreferenceBuilder newBuilder()
public static Preference make(long uid, long iid, double val)
uid
- The user ID.iid
- The item ID.val
- The value.public static MutableSparseVector userPreferenceVector(Collection<? extends Preference> prefs)
prefs
- The user's preferences.IllegalArgumentException
- if the same item appears multiple times, or there are
preferences from multiple users.public static int hashPreference(Preference preference)
Object.hashCode()
in preference
implementations.preference
- The preference.public static boolean equals(Preference p1, Preference p2)
Object.equals(Object)
in preference
implementations.p1
- The first preference.p2
- The second preference.