Hack introduces the concept of Collections. Collections are basically used for data storage and retrieval. Collections implement many of the same interfaces and are extendable to create even more specialized collections
Currently, Hack implements the following concrete collection types:
Vector: Index-based list collection.
Map: Dictionary style collection.
Set: List based collection that stores unique values.
Pair: Index based collection that can hold exactly two values.
Immutable Collection:
Vector, Map, Set and Pair are mutable collection. Hack also supports immutable collections.
As the name indicates, an immutable collection does not support addition and removal of its elements.
The immutable collection types are:
ImmVector,   ImmSet,   ImmMap   and   ImmPair
Limitations of Collection:
  • Collections do not allow taking elements by reference for performance and type safety reasons
  • Collection does not support dynamic properties
  • Collection does not support <, <=, >, and >= operators.

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.