In addition to fully supporting the one-size-fits-all PHP array container type, Hack allows additional typing to be placed on arrays, and provides a number of classes which implement more specialized collecion patterns. Arrays in Hack behave similarly to Generics in that additional type information may be provided about how they are specialized. For example, an unindexed array of strings takes the form array<,string>,. Similarly, for indexed arrays, the key type (int or string) may be specified first, followed by the value type. So a dictionary with string keys and floating point values might look like array<,string, float>,. Since the value side of an array may itself be an array (or a Generic class), type specialization may be nested as with array<,int, array<,string, string>,>, which is a numerically indexed array containing string dictionaries. While PHP Arrays are extremely versatile, that flexibility occaisionally comes at a cost either in terms of performance, correctness, or readability. Hack Collection classes seek to resolve those issues by providing deeply specialized object versions of arrays in the form of common container patterns: Vector, Map, and Set. Is this array a vector-style array with sequential integer keys? Or maybe a map-style array with potentially non-sequential integer keys? Are the values in this array unique? By looking at the function signature, we know those integer keys are ordered and sequential. That the actual key number is probably much less relevant that the thing its holding. Then we realize that those integer keys were irrelevant, and that the strings contained in this parameter will all have unique values. The obvious benefit in Vectors and Sets are that the keys can be ignored by the runtime. For Vectors that means layouting out the values contiguously and having fast lookup and iteration based on index. In the case of Sets it actually means (as an implementation detail) turning the internal structure inside out, using the values as keys (which must be unique), and ignoring the other half of the array pair. This is a pattern already available to PHP code, but it removes the cognitive overhead of having to remember that the array is inside out, and does it in a more efficient way than script code is able to do. Here is the typical-case amortized time complexity for operations on the key collection classes and array: Related to readability, the Hack typechecker cannot tell, for example, whether the context of your code is passing an array used like a vector to a function with a parameter of an array used like a map. For example, the following code passes the typechecker. However, if you take a similar style of code, but instead use Vector and Map, the typechecker can easily tell the intent. Using Hack collections gives the typechecker more data to work with in trying to decide whether you have typing problems in your code. Source.