#

API Docs for: v2.11.1
Show: Inherited Protected Private Deprecated

# Ember.MapWithDefault Class

Extends Ember.Map
Defined in: `packages/ember-metal/lib/map.js:411`
Module: ember-metal
Parent Module: ember

## Constructor

### `Ember.MapWithDefault`

(

- `[options]`

)
private

Defined in `packages/ember-metal/lib/map.js:411`

#### Parameters:

- `[options]` Object optional
  - `[defaultValue]` optional

- Index
- Methods
- Properties

## Item Index

### Methods

- clear
- copy
- create static
- delete
- forEach
- get
- has
- set

### Properties

- size

## Methods

### `clear`

() private

Inherited from Ember.Map: `packages/ember-metal/lib/map.js:391`

### `copy`

() Ember.MapWithDefault private

Inherited from Ember.Map but overwritten in `packages/ember-metal/lib/map.js:467`

#### Returns:

Ember.MapWithDefault:

### `create`

(

- `[options]`

)
Ember.MapWithDefault | Ember.Map private static

Defined in `packages/ember-metal/lib/map.js:425`

#### Parameters:

- `[options]` Object optional
  - `[defaultValue]` optional

#### Returns:

Ember.MapWithDefault | Ember.Map:

If options are passed, returns `Ember.MapWithDefault` otherwise returns `Ember.Map`

### `delete`

(

- `key`

)
Boolean private

Inherited from Ember.Map: `packages/ember-metal/lib/map.js:320`

Available since 1.8.0

Removes a value from the map for an associated key.

#### Parameters:

- `key`

#### Returns:

Boolean:

true if an item was removed, false otherwise

### `forEach`

(

- `callback`
- `self`

)
private

Inherited from Ember.Map: `packages/ember-metal/lib/map.js:358`

Iterate over all the keys and values. Calls the function once for each key, passing in value, key, and the map being iterated over, in that order.

The keys are guaranteed to be iterated over in insertion order.

#### Parameters:

- `callback` Function
- `self`

  if passed, the `this` value inside the callback. By default, `this` is the map.

### `get`

(

- `key`

)
private

Inherited from Ember.Map but overwritten in `packages/ember-metal/lib/map.js:447`

Retrieve the value associated with a given key.

#### Parameters:

- `key`

#### Returns:

:

the value associated with the key, or the default value

### `has`

(

- `key`

)
Boolean private

Inherited from Ember.Map: `packages/ember-metal/lib/map.js:346`

Check whether a key is present.

#### Parameters:

- `key`

#### Returns:

Boolean:

true if the item was present, false otherwise

### `set`

(

- `key`
- `value`

)
Ember.Map private

Inherited from Ember.Map: `packages/ember-metal/lib/map.js:293`

Adds a value to the map. If a value for the given key has already been provided, the new value will replace the old value.

#### Parameters:

- `key`
- `value`

#### Returns:

Ember.Map:

## Properties

### `size`

Number private

Inherited from Ember.Map: `packages/ember-metal/lib/map.js:265`

Available since 1.8.0

This property will change as the number of objects in the map changes.

Default: 0