HH\Set::keys

Returns a Vector containing the values of the current Set.

Description

public function keys(): Vector<mixed>

Returns a Vector containing the values of the current Set.

Sets don't have keys, so this will return the values.

This method is interchangeable with toVector() and values().

Return Values

Examples

This example shows that keys() returns a Vector of the Set's values because Sets don't have keys:

<?hh

namespace Hack\UserDocumentation\API\Examples\Set\Keys;

$s = Set {'red', 'green', 'blue', 'yellow'};
var_dump($s->keys());
Output
object(HH\Vector)#2 (4) {
  [0]=>
  string(3) "red"
  [1]=>
  string(5) "green"
  [2]=>
  string(4) "blue"
  [3]=>
  string(6) "yellow"
}