HH\Lib\C\is_empty

Meta Engineer?

This is available as C\is_empty in the www repository.

Returns whether the given Container is empty

namespace HH\Lib\C;

function is_empty<T>(
  Container<T> $container,
): bool;

Time complexity: O(1) Space complexity: O(1)

Parameters

Returns

  • bool

Examples

$strings = vec["a", "b", "c", "d", "e"];
$is_empty_result_1 = C\is_empty($strings);
echo "First is_empty result: $is_empty_result_1\n";
//Output: First is_empty result: false

$empty_strings = vec[];
$is_empty_result_2 = C\is_empty($empty_strings);
echo "Second is_empty result: $is_empty_result_2\n";
//Output: Second is_empty result: true