Let's say, I have a vec<int> containing a list of integers that may be non-continuous (due to element being removed from database).
Example:
$occupiedNumbers = vec[1, 2, 3, 5, 6, 8, 10, 11, 12, 13, 15, 16];
Now what I need is to check if this vec contains a given number, and if yes, increase it by 1 and repeat checking.
$newItemNumber = count($occupiedNumbers);
while (/* check if $occupiedNumbers contains $newItemNumber */) {
$a++;
}
In vanilla PHP there is in_array() for this, but would that work for a vec? Also, there is a builtin HH\Vector::linearSearch() but it's meant to be used with vec's predecessor, HH\Vector.
What is the right solution to check if a vec contains a given value?
Neither HHVM nor Hack docs say about that use case for a vec. Also, I'm missing some sort of REPL tool to check it manually off-project without building a whole (possibly faulty) project.