Please wait while we load your page...

PasswordSentry

Latest Version [8.00202205221] Last Updated [May-22-2022]

Tools

PHP Manual [The Set class]

Protect Your Website Today


PHP Manual || Data Structures

(No version information available, might only be in Git)

A Set is a sequence of unique values. This implementation uses the same hash table as Ds\Map, where values are used as keys and the mapped value is ignored.

  • Values can be any type, including objects.
  • Supports array syntax (square brackets).
  • Insertion order is preserved.
  • Automatically frees allocated memory when its size drops low enough.
  • add(), remove() and contains() are all O(1).

  • Doesn’t support push(), pop(), insert(), shift(), or unshift().
  • get() is O(n) if there are deleted values in the buffer before the accessed index, O(1) otherwise.

Ds\Set implements Ds\Collection {
/* Constants */
const int MIN_CAPACITY = 16 ;
/* Methods */
public add ([ mixed $...values ] ) : void
public allocate ( int $capacity ) : void
public capacity ( void ) : int
public clear ( void ) : void
public contains ([ mixed $...values ] ) : bool
public copy ( void ) : Ds\Set
public diff ( Ds\Set $set ) : Ds\Set
public filter ([ callable $callback ] ) : Ds\Set
public first ( void ) : mixed
public get ( int $index ) : mixed
public intersect ( Ds\Set $set ) : Ds\Set
public isEmpty ( void ) : bool
public join ([ string $glue ] ) : string
public last ( void ) : mixed
public merge ( mixed $values ) : Ds\Set
public reduce ( callable $callback [, mixed $initial ] ) : mixed
public remove ([ mixed $...values ] ) : void
public reverse ( void ) : void
public reversed ( void ) : Ds\Set
public slice ( int $index [, int $length ] ) : Ds\Set
public sort ([ callable $comparator ] ) : void
public sorted ([ callable $comparator ] ) : Ds\Set
public sum ( void ) : number
public toArray ( void ) : array
public union ( Ds\Set $set ) : Ds\Set
public xor ( Ds\Set $set ) : Ds\Set
}
Ds\Set::MIN_CAPACITY



PHP Manual || Data Structures