```java
Amplify.DataStore.query(Comment.class, Post.STATUS.eq(PostStatus.ACTIVE),
matches -> {
while (matches.hasNext()) {
Comment comment = matches.next();
Log.i("MyAmplifyApp", "Content: " + comment.getContent());
}
},
failure -> Log.e("MyAmplifyApp", "Query failed.", failure)
);
```
```kotlin
Amplify.DataStore.query(Comment::class.java, Post.STATUS.eq(PostStatus.ACTIVE),
{ matches ->
while (matches.hasNext()) {
val comment = matches.next()
Log.i("MyAmplifyApp", "Content: ${comment.content}")
}
},
{ Log.e("MyAmplifyApp", "Query failed", it) }
)
```
```kotlin
Amplify.DataStore
.query(Comment::class, Where.matches(Post.STATUS.eq(PostStatus.ACTIVE)))
.catch { Log.e("MyAmplifyApp", "Query failed", it) }
.collect { Log.i("MyAmplifyApp", "Content: ${it.content}") }
```
```java
RxAmplify.DataStore.query(Comment.class, Post.STATUS.eq(PostStatus.ACTIVE))
.subscribe(
comment -> Log.i("MyAmplifyApp", "Content: " + comment.getContent()),
failure -> Log.e("MyAmplifyApp", "Query failed.", failure)
);
```