{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-java/issues/1270","labels_url":"https://api.github.com/repos/realm/realm-java/issues/1270/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/1270/comments","events_url":"https://api.github.com/repos/realm/realm-java/issues/1270/events","html_url":"https://github.com/realm/realm-java/issues/1270","id":93524329,"number":1270,"title":"Check if a relationship has any objects","user":{"login":"koesie10","id":1112623,"avatar_url":"https://avatars.githubusercontent.com/u/1112623?v=3","gravatar_id":"","url":"https://api.github.com/users/koesie10","html_url":"https://github.com/koesie10","followers_url":"https://api.github.com/users/koesie10/followers","following_url":"https://api.github.com/users/koesie10/following{/other_user}","gists_url":"https://api.github.com/users/koesie10/gists{/gist_id}","starred_url":"https://api.github.com/users/koesie10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koesie10/subscriptions","organizations_url":"https://api.github.com/users/koesie10/orgs","repos_url":"https://api.github.com/users/koesie10/repos","events_url":"https://api.github.com/users/koesie10/events{/privacy}","received_events_url":"https://api.github.com/users/koesie10/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-07T12:53:59Z","updated_at":"2015-07-08T04:33:50Z","closed_at":null,"body":"I have basically got the following objects:\r\n```\r\npublic class A extends RealmObject {\r\n    private RealmList<B> items;\r\n}\r\n\r\npublic class B extends RealmObject {\r\n}\r\n```\r\n\r\nI now want to check whether `A` has any associated objects. Is there a way to check if the count of `items` is larger than `0`, i.e. if `A` has any related objects?"},"comment":{"url":"https://api.github.com/repos/realm/realm-java/issues/comments/119427764","html_url":"https://github.com/realm/realm-java/issues/1270#issuecomment-119427764","issue_url":"https://api.github.com/repos/realm/realm-java/issues/1270","id":119427764,"user":{"login":"beeender","id":449296,"avatar_url":"https://avatars.githubusercontent.com/u/449296?v=3","gravatar_id":"","url":"https://api.github.com/users/beeender","html_url":"https://github.com/beeender","followers_url":"https://api.github.com/users/beeender/followers","following_url":"https://api.github.com/users/beeender/following{/other_user}","gists_url":"https://api.github.com/users/beeender/gists{/gist_id}","starred_url":"https://api.github.com/users/beeender/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beeender/subscriptions","organizations_url":"https://api.github.com/users/beeender/orgs","repos_url":"https://api.github.com/users/beeender/repos","events_url":"https://api.github.com/users/beeender/events{/privacy}","received_events_url":"https://api.github.com/users/beeender/received_events","type":"User","site_admin":false},"created_at":"2015-07-08T04:33:50Z","updated_at":"2015-07-08T04:33:50Z","body":"Try this [`RealmQuery.isNotNull`](https://realm.io/docs/java/latest/api/io/realm/RealmQuery.html#isNotNull-java.lang.String-)\r\n\r\n```\r\nRealmResults<A> results = realm.where(A.class).isNotNull(\"items\").findAll();\r\n```"}}