Created
August 19, 2017 02:57
-
-
Save LeeReindeer/35c4e563c01b0393a232812c960e335d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int nextID() { | |
try { | |
Number number = realm.where(object).max("id"); | |
if (number != null) { | |
return number.intValue() + 1; | |
} else { | |
return 0; | |
} | |
} catch (ArrayIndexOutOfBoundsException e) { | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment