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