The Map is a sequential collection of key-value pairs, almost identical to an array used in a similar context. The keys can be of any type but must be unique, and the values are replaced if added to the map by using the same key.
Ds\Map implements Ds\Collection { /* Constants */ const int MIN_CAPACITY = 16 ; /* Methods */ public void allocate( int $capacity ) public void apply( callable $callback ) public int capacity( void ) public void clear( void ) public Ds\Map copy( void ) public Ds\Map diff( Ds\Map $map ) public Ds\Map filter([ callable $callback ] ) public Ds\Pair first( void ) public mixed get( mixed $key [, mixed $default ] ) public bool hasKey( mixed $key ) public bool hasValue( mixed $value ) public Ds\Map intersect( Ds\Map $map ) public bool isEmpty( void ) public Ds\Set keys( void ) public void ksort([ callable $comparator ] ) public Ds\Map ksorted([ callable $comparator ] ) public Ds\Pair last( void ) public Ds\Map map( callable $callback ) public Ds\Map merge( mixed $values ) public Ds\Sequence pairs( void ) public void put( mixed $key , mixed $value ) public void putAll( mixed $pairs ) public mixed reduce( callable $callback [, mixed $initial ] ) public mixed remove( mixed $key [, mixed $default ] ) public void reverse( void ) public Ds\Map reversed( void ) public Ds\Pair skip( int $position ) public Ds\Map slice int $index [, int $length ] ) public void sort([ callable $comparator ] ) public Ds\Map sorted([ callable $comparator ] ) public number sum( void ) public array toArray( void ) public Ds\Map union( Ds\Map $map ) public Ds\Sequence values( void ) public Ds\Map xor( Ds\Map $map ) }
Ds\Map::MIN_CAPACITY
Sr.No | Function & Description |
---|---|
1 |
This Function can allocate enough memory for the required capacity. |
2 |
This Function can update update all values by applying a callback function to each value. |
3 |
This Function can return the current capacity. |
4 |
This Function can remove remove all values. |
5 |
This Function can return the shallow copy of a map. |
6 |
This Function can return the number of values in a map. |
7 |
This Function can create a new map by using keys that aren't in another map. |
8 |
This Function can create a new map by using a callable to determine which pairs to include. |
9 |
This Function can return the first pair in a map. |
10 |
This Function can return the value for a given key. |
11 |
This Function can determine whether the map contain a given key. |
12 |
This Function can determine whether the map contain a given value. |
13 |
This Function can create a new map by intersecting keys with another map. |
14 |
This Function can return return whether the map is empty. |
15 | Ds\Map::jsonSerialize() Function This Function can return a representation that can be converted to JSON. |
16 |
This Function can return the set of map's keys. |
17 |
This Function can sort the map in-place by key. |
18 |
This Function can return a copy, sorted by key. |
19 |
This Function can return the last pair of a map. |
20 |
This Function can return the result of applying a callback to each value. |
21 |
This Function can return the result of adding all given associations. |
22 |
This Function can return a sequence containing all pairs of the map. |
23 |
This Function can associate a key with a value. |
24 |
This Function can associate all key-value pairs of traversable object or array. |
25 |
This Function can reduce the map to a single value by using a callback function. |
26 |
This Function can remove and return a value by key. |
27 |
This Function can can reverse the map in-place. |
28 |
This Function can return a reversed copy. |
29 |
This Function can return the pair at a given positional index. |
30 |
This Function can return a subset of the map defined by starting index and length. |
31 |
This Function can sort the map in-place by value. |
32 |
This Function can return a copy sorted by value. |
33 |
This Function can return the sum of all values in a map. |
34 |
This Function can convert a map to an array. |
35 |
This Function can create a new map using values from the current instance and another map. |
36 |
This Function can return a sequence of the map's values. |
37 |
This Function can create a new map using the keys of either current instance or of another map, but not of both. |