id
Override the default id in cases where the data subject naturally has an id, like an objectfrom a database. This id can only be set before the model is added to the adapter, it is anerror to change the id after that.
Use multiple numbers as the id for this model. Useful when you don't have a single long thatrepresents a unique id.
This hashes the numbers, so there is a tiny risk of collision with other ids.
Use two numbers as the id for this model. Useful when you don't have a single long thatrepresents a unique id.
This hashes the two numbers, so there is a tiny risk of collision with other ids.
Use a string as the model id. Useful for models that don't clearly map to a numerical id. Thisis preferable to using hashCode because that is a 32 bit hash and this is a 64bit hash, giving better spread and less chance of collision with other ids.
Since this uses a hashcode method to convert the String to a long there is a very small chancethat you may have a collision with another id. Assuming an even spread of hashcodes, andseveral hundred models in the adapter, there would be roughly 1 in 100 trillion chance of acollision. (http://preshing.com/20110504/hash-collision-probabilities/)
See also
IdUtils#hashString64Bit(CharSequence)
Use several strings to define the id of the model.
Similar to id, but with additional strings.
Set an id that is namespaced with a string. This is useful when you need to show models ofmultiple types, side by side and don't want to risk id collisions.
Since this uses a hashcode method to convert the String to a long there is a very small chancethat you may have a collision with another id. Assuming an even spread of hashcodes, andseveral hundred models in the adapter, there would be roughly 1 in 100 trillion chance of acollision. (http://preshing.com/20110504/hash-collision-probabilities/)
See also
IdUtils#hashLong64Bit(long)