Package org.apache.lucene.util

# Class MapOfSets<K,V>

java.lang.Object
org.apache.lucene.util.MapOfSets<K,V>

public class MapOfSets<K,V> extends Object
Helper class for keeping Lists of Objects associated with keys. WARNING: THIS CLASS IS NOT THREAD SAFE

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

## Constructor Summary

Constructors
Constructor
Description
`MapOfSets(Map<K,Set<V>> m)`

## Method Summary

Modifier and Type
Method
Description
`Map<K,Set<V>>`
`getMap()`
`int`
`put(K key, V val)`
Adds val to the Set associated with key in the Map.
`int`
`putAll(K key, Collection<? extends V> vals)`
Adds multiple vals to the Set associated with key in the Map.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### MapOfSets

public MapOfSets(Map<K,Set<V>> m)

Parameters:
  `m` - the backing store for this object

## Method Details

### getMap

public Map<K,Set<V>> getMap()

Returns:
  direct access to the map backing this object.

### put

public int put(K key, V val)
Adds val to the Set associated with key in the Map. If key is not already in the map, a new Set will first be created.

Returns:
  the size of the Set associated with key once val is added to it.

### putAll

public int putAll(K key, Collection<? extends V> vals)
Adds multiple vals to the Set associated with key in the Map. If key is not already in the map, a new Set will first be created.

Returns:
  the size of the Set associated with key once val is added to it.