HH\Lib\C\first

This API is part of the Hack Standard Library, not HHVM itself.
Facebook Engineer?

This function is available as C\first() in Facebook's www repository.

Returns the first element of the given Traversable, or null if the Traversable is empty

Description

namespace HH\Lib\C;

function first<T>(
  Traversable<T> $traversable,
): ?T;

For non-empty Traversables, see C\firstx. For possibly null Traversables, see C\nfirst. For single-element Traversables, see C\onlyx. For Awaitables that yield Traversables, see C\first_async.

Parameters