# Class: com.pnfsoftware.jeb.util.collect.SetMap

A map of keys to sets. Keys may be ordered \(none, natural, by insertion\); the ordering for the value sets may be specified as well. This class is [serializable](Ser). Null key is allowed except for natural ordering; null values are allowed. 

 Thread\-safety: none. 

 Note: this class does not implement the [Map](Map) interface, but attempts to follow its guidelines and contracts the best it can. One notable exception is that this class does not override hashCode/equals.

## Constructor: SetMap

Description: Create a new set\-map without any particular ordering.

## Constructor: SetMap
- parameter: `keyOrder`, type: `com.pnfsoftware.jeb.util.collect.CollectionOrder`
- parameter: `setOrder`, type: `com.pnfsoftware.jeb.util.collect.CollectionOrder`

Description: Create a new set\-map.
parameter: keyOrder: key ordering
parameter: setOrder: value\-set ordering

## Method: clear

Description: Remove all key\-value mappings.

## Method: containsKey
- parameter: `key`, type: `K`
- return type: `boolean`

Description: Determine whether this set\-map contains a key.
parameter: key: key
return: true if the key is present

## Method: containsValue
- parameter: `value`, type: `V`
- return type: `boolean`

Description: Determine whether this set\-map contains a value.
parameter: value: value
return: true if any key maps to the value

## Method: createKey
- parameter: `key`, type: `K`
- return type: `boolean`

Description: Create an explicit entry for a given key. If no values mapped by the given key previously existed, the associated value will be an empty collection.
parameter: key: key
return: true if the map did not already contain the key; false otherwise \(the key entry         existed before\)

## Method: get
- parameter: `key`, type: `K`
- return type: `java.util.Set<V>`

Description: Retrieve the values associated with a key.
parameter: key: key
return: read\-only set of values, or null if the key is absent

## Method: get
- parameter: `key`, type: `K`
- parameter: `safe`, type: `boolean`
- return type: `java.util.Set<V>`

Description: Retrieve the values associated with a key.
parameter: key: key
parameter: safe: if true, an empty collection of values is returned if the key does not exist
return: read\-only set of values, possibly null or empty depending on `safe`

## Method: getSafe
- parameter: `key`, type: `K`
- return type: `java.util.Set<V>`

Description: Retrieve the values associated with a key.
parameter: key: key
return: a non\-null set of values

## Method: isEmpty
- return type: `boolean`

Description: Determine whether this set\-map has no values.
return: true if no values are mapped

## Method: keySet
- return type: `java.util.Set<K>`

Description: Retrieve a read\-only view of the keys. 

 WARNING: This method does not respect the [Map#keySet()](Map#keySet()) contract: the set returned is read\-only.
return: read\-only view of the key set

## Method: keySize
- return type: `int`

Description: Get the number of keys in this set\-map.
return: number of keys, including keys mapped to empty value sets

## Method: put
- parameter: `key`, type: `K`
- parameter: `value`, type: `V`
- return type: `int`

Description: Add a key\-value mapping.
parameter: key: key
parameter: value: value
return: the updated count of values associated with the key

## Method: putAll
- parameter: `m`, type: `java.util.Map<? extends K,java.util.List<? extends V>>`

Description: Add all mappings from a map of keys to lists of values.
parameter: m: map of values to add

## Method: putMulti
- parameter: `key`, type: `K`
- parameter: `values`, type: `java.util.Collection<? extends V>`

Description: Add multiple elements mapped by the same key. Note that if an empty collection is provided, the entry for the provided key will not be be explicitly created.
parameter: key: key
parameter: values: values to add

## Method: remove
- parameter: `key`, type: `K`
- return type: `java.util.Set<V>`

Description: Remove all values associated with a key.
parameter: key: key
return: removed values, or null if the key was absent

## Method: removeAll
- parameter: `keys`, type: `java.util.Collection<K>`
- return type: `boolean`

Description: Remove all entries mapping to the collection of keys. 

 Similar semantics as [Set#removeAll(Collection)](Set#removeAll(Collection)).
parameter: keys: keys to remove
return: true if the multi\-map was modified

## Method: removeMulti
- parameter: `key`, type: `K`
- parameter: `values`, type: `java.util.Collection<? extends V>`
- return type: `int`

Description: Remove multiple values associated with a key.
parameter: key: key
parameter: values: values to remove
return: number of removed values

## Method: removeValue
- parameter: `key`, type: `K`
- parameter: `value`, type: `V`
- return type: `V`

Description: Remove a value associated with a key.
parameter: key: key
parameter: value: value to remove
return: removed value, or null if no value was removed

## Method: size
- return type: `int`

Description: Get the number of key\-value mappings \(per Map interface\). That is, the number of values.
return: number of values

## Method: toString
- return type: `java.lang.String`


## Method: values
- return type: `java.util.Set<V>`

Description: 
deprecated: use [#valuesCopy()](#valuesCopy()) instead

## Method: valuesCopy
- return type: `java.util.Set<V>`

Description: Retrieve a copy of all unique stored values. If a same value appears in multiple buckets, only one is provided.
return: read\-only a set of copied values

## Method: valuesIterator
- return type: `java.util.Iterator<V>`

Description: Retrieve an iterator for all values. If a value appears in N buckets, it will be provided N times.
return: an iterator over all values

