<BlockSwitcher>
<Block name="Java">

```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)
);
```

</Block>
<Block name="Kotlin - Callbacks">

```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) }
)
```

</Block>
<Block name="Kotlin - Coroutines">

```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") }
```

</Block>
<Block name="RxJava">

```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)
    );
```

</Block>

</BlockSwitcher>
