(No hay información de versión disponible, podría estar únicamente en SVN)
Introducción
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.
Strengths
- 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).
Weaknesses
- 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.
Sinopsis de la Clase
Ds\Set
implements
Ds\Collection
{
public void clear
(
void
)
public Ds\Set copy
(
void
)
public Ds\Set diff
(
Ds\Set $set
)
public void first
(
void
)
public mixed get
(
int $index
)
public string join
([
string $glue
] )
public void last
(
void
)
public Ds\Set slice
(
int $index
[,
int $length
] )
public number sum
(
void
)
public Ds\Set union
(
Ds\Set $set
)
public Ds\Set xor
(
Ds\Set $set
)
}
Constantes predefinidas
Ds\Set::MIN_CAPACITY
-