PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

The Map class | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

The Map class

(バージョン情報なし。おそらく SVN 版にしか存在しないでしょう)

はじめに

A Map is a sequential collection of key-value pairs, almost identical to an array used in a similar context. Keys can be any type, but must be unique. Values are replaced if added to the map using the same key.

Strengths

  • Keys and values can be any type, including objects.
  • Supports array syntax (square brackets).
  • Insertion order is preserved.
  • Performance and memory efficiency is very similar to an array.
  • Automatically frees allocated memory when its size drops low enough.

Weaknesses

  • Can’t be converted to an array when objects are used as keys.

クラス概要

Ds\Map implements Ds\Collection {
/* Constants */
const int MIN_CAPACITY = 16 ;
/* メソッド */
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

目次


忘却曲線を使ってこの知識を確実に記憶に残す

フォーラムで「The Map class」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | The Map class」をGoogle検索
copyright © 1997-2022 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: