isEmpty

IsEmpty( collection )
IsEmpty( collection )
IsEmpty( collection )
IsEmpty( collection )
is_empty( collection )
is_empty( collection )
IsEmpty( collection )
IsEmpty( collection )

Description

The IsEmpty function returns true only if there are no elements in the array.

Parameters

Argument Type Definition and Requirements

array

An array which is checked for the non-existence of elements.

Returns

Returns a boolean.

Examples

The query below executes an array of independent IsEmpty operations and returns the results in an array. The result array position matches the execution array position. The first IsEmpty operation operates on an empty array and places the result of true in the top position in the result array. The second IsEmpty operation operates on an array with a single value of 1 and places the result of false in the second position in the result array. The third IsEmpty operation operates on an array with a two values and places the result of false in the third position in the result array.

System.out.println(
  client.query(
    Arr(
        IsEmpty( Arr()),
        IsEmpty( Arr(Value(1))),
        IsEmpty( Arr(Value(1), Value(2), Value(3)))
    )
  ).get());
[true, false, false]

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve! documentation@fauna.com

Thank you for your feedback!