MutableRealmIntegers are most interesting as members of a managed RealmModel object.
When managed, the increment(long) and decrement(long) operators implement a
conflict free replicated data type:
Simultaneous increments and decrements from multiple distributed clients will be aggregated correctly.
For instance, if the value of counter field for the object representing user "Fred" is currently 0,
then the following code, executed on two different devices, simultaneously, even if connected by only a slow,
unreliable network, will always cause the value of counter to converge, eventually on the value 2.

Note that the set(Long) operator must be used with extreme care. It will quash the effects of any prior calls
to increment(long) or decrement(long). Although the value of a MutableRealmInteger will
always converge across devices, the specific value on which it converges will depend on the actual order in which
operations took place. Mixing set(Long) with increment(long) and decrement(long) is,
therefore, not advised, unless fuzzy counting is acceptable.

MutableRealmIntegers may not be primary keys. Their implementations are not thread safe.
Like all managed Realm objects, managed MutableRealmIntegers may not be moved across threads.
Unmanaged MutableRealmIntegers may be moved across threads but require safe publication.

A MutableRealmInteger, in a model class, must always be declared final. For instance:

public final MutableRealmInteger counter = MutableRealmInteger.ofNull();

Although initializing the MutableRealmInteger as null may work very limited circumstances,
developers are advised not to do it:

public final MutableRealmInteger counter = null; // DO NOT DO THIS!

Also note that when a MutableRealmInteger is @Required, it is better, though not required,
to initialize it with a non-null value.

A reference to a managed MutableRealmInteger is subject to all of the constraints that apply
to the model object from which it was obtained: It can only be mutated within a transaction and
it becomes invalid if the Realm backing it is closed. Use the isManaged()
and isValid() operators to determine whether a MutableRealmInteger is
in a consistent state. Note, in particular, that a reference to a managed MutableRealmInteger
retains a reference to the model object to which it belongs. For example in this code:

get

set

Sets the MutableRealmInteger value.
Calling set forcibly sets the MutableRealmInteger to the provided value.
Doing this obliterates the effects of any calls to increment(long) and decrement(long) perceived
before the call to set.