Associated function in collections::map · HashMap coil-stdlib

HashMap::with_capacity

pub static fn with_capacity(int cap) -> HashMap<K, V>
Import
use collections::map::{HashMap};
Source: src/collections/map.hy

Creates an empty map with room for about cap buckets before it grows.

The bucket count is rounded up to a power of two, at least 8.

Parameters#

NameType
capint

Returns#

HashMap<K, V>

Examples#

use collections::map::{HashMap};
use tests::assert;
let m: HashMap<int, string> = HashMap::with_capacity(100);
assert!(m.is_empty());
assert!(m.capacity() >= 100);

See also#

↑ ↓ navigate ↵ open