title: How do I set a unique primary key in Realm?
body: <p>How do I set a unique primary key in Realm in Android? The Realm documentation says I cannot use anything but String or int/long, so is UUID type is out of the question too? What if I have items with the same name? </p>
  
  <p>e.g.</p>
  
  <pre><code>public class GroceryItem extends RealmObject {
      @PrimaryKey
      private long        id;    &lt;--- how can I make this unique without UUID?
      private String      name;
  
  public long getId() {
      return id;
  }
  public void setId(long id) {
      this.id = id;
  }
  public String getName() {
      return name;
  }
  public void setName(String name) {
      this.name = name;
  } }
  </code></pre>