# Class Headers<K,V>

java.lang.Object
java.util.Dictionary<K,V>
org.eclipse.osgi.framework.util.Headers<K,V>

All Implemented Interfaces:
  `Map<K,V>`

@Deprecated public class Headers<K,V> extends Dictionary<K,V> implements Map<K,V>
Deprecated.
As of 3.13. Replaced by `CaseInsensitiveDictionaryMap`.
Headers classes. This class implements a Dictionary that has the following behavior:

- put and remove clear throw UnsupportedOperationException. The Dictionary is thus read-only to others.
- The String keys in the Dictionary are case-preserved, but the get operation is case-insensitive.

Since:
  3.1

## Nested Class Summary

### Nested classes/interfaces inherited from interface Map

`Map.Entry<K,V>`

## Constructor Summary

Constructors
Constructor
Description
`Headers(int initialCapacity)`
Deprecated.
Create an empty Headers dictionary.
`Headers(Dictionary<? extends K, ? extends V> values)`
Deprecated.
Create a Headers dictionary from a Dictionary.

## Method Summary

Modifier and Type
Method
Description
`void`
`clear()`
Deprecated.
`boolean`
`containsKey(Object key)`
Deprecated.
`boolean`
`containsValue(Object value)`
Deprecated.
`Enumeration<V>`
`elements()`
Deprecated.
Values.
`Set<Map.Entry<K,V>>`
`entrySet()`
Deprecated.
`V`
`get(Object key)`
Deprecated.
Support case-insensitivity for keys.
`boolean`
`isEmpty()`
Deprecated.
Tests if this dictionary maps no keys to value.
`Enumeration<K>`
`keys()`
Deprecated.
Case-preserved keys.
`Set<K>`
`keySet()`
Deprecated.
`static Headers<String,String>`
`parseManifest(InputStream in)`
Deprecated.
`V`
`put(K key, V value)`
Deprecated.
Always throws UnsupportedOperationException.
`void`
`putAll(Map<? extends K, ? extends V> c)`
Deprecated.
`V`
`remove(Object key)`
Deprecated.
Always throws UnsupportedOperationException.
`V`
`set(K key, V value)`
Deprecated.
Set a header value.
`V`
`set(K key, V value, boolean replace)`
Deprecated.
Set a header value or optionally replace it if it already exists.
`void`
`setReadOnly()`
Deprecated.
`int`
`size()`
Deprecated.
Returns the number of entries (distinct keys) in this dictionary.
`String`
`toString()`
Deprecated.
`Collection<V>`
`values()`
Deprecated.

### Methods inherited from class Object

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

### Methods inherited from interface Map

`compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll`

## Constructor Details

### Headers

public Headers(int initialCapacity)
Deprecated.
Create an empty Headers dictionary.

Parameters:
  `initialCapacity` - The initial capacity of this Headers object.

### Headers

public Headers(Dictionary<? extends K, ? extends V> values)
Deprecated.
Create a Headers dictionary from a Dictionary.

Parameters:
  `values` - The initial dictionary for this Headers object.
Throws:
  `IllegalArgumentException` - If a case-variant of the key is in the dictionary parameter.

## Method Details

### keys

public Enumeration<K> keys()
Deprecated.
Case-preserved keys.

Specified by:
  `keys` in class `Dictionary<K,V>`

### elements

public Enumeration<V> elements()
Deprecated.
Values.

Specified by:
  `elements` in class `Dictionary<K,V>`

### get

public V get(Object key)
Deprecated.
Support case-insensitivity for keys.

Specified by:
  `get` in interface `Map<K,V>`
Specified by:
  `get` in class `Dictionary<K,V>`
Parameters:
  `key` - name.

### set

public V set(K key, V value, boolean replace)
Deprecated.
Set a header value or optionally replace it if it already exists.

Parameters:
  `key` - Key name.
  `value` - Value of the key or null to remove key.
  `replace` - A value of true will allow a previous value of the key to be replaced. A value of false will cause an IllegalArgumentException to be thrown if a previous value of the key exists.
Returns:
  the previous value to which the key was mapped, or null if the key did not have a previous mapping.
Throws:
  `IllegalArgumentException` - If a case-variant of the key is already present.
Since:
  3.2

### set

public V set(K key, V value)
Deprecated.
Set a header value.

Parameters:
  `key` - Key name.
  `value` - Value of the key or null to remove key.
Returns:
  the previous value to which the key was mapped, or null if the key did not have a previous mapping.
Throws:
  `IllegalArgumentException` - If a case-variant of the key is already present.

### setReadOnly

public void setReadOnly()
Deprecated.

### size

public int size()
Deprecated.
Returns the number of entries (distinct keys) in this dictionary.

Specified by:
  `size` in interface `Map<K,V>`
Specified by:
  `size` in class `Dictionary<K,V>`
Returns:
  the number of keys in this dictionary.

### isEmpty

public boolean isEmpty()
Deprecated.
Tests if this dictionary maps no keys to value. The general contract for the `isEmpty` method is that the result is true if and only if this dictionary contains no entries.

Specified by:
  `isEmpty` in interface `Map<K,V>`
Specified by:
  `isEmpty` in class `Dictionary<K,V>`
Returns:
  `true` if this dictionary maps no keys to values; `false` otherwise.

### put

public V put(K key, V value)
Deprecated.
Always throws UnsupportedOperationException.

Specified by:
  `put` in interface `Map<K,V>`
Specified by:
  `put` in class `Dictionary<K,V>`
Parameters:
  `key` - header name.
  `value` - header value.

### remove

public V remove(Object key)
Deprecated.
Always throws UnsupportedOperationException.

Specified by:
  `remove` in interface `Map<K,V>`
Specified by:
  `remove` in class `Dictionary<K,V>`
Parameters:
  `key` - header name.

### toString

public String toString()
Deprecated.

Overrides:
  `toString` in class `Object`

### parseManifest

public static Headers<String,String> parseManifest(InputStream in) throws BundleException
Deprecated.

Throws:
  `BundleException`

### clear

public void clear()
Deprecated.

Specified by:
  `clear` in interface `Map<K,V>`

### containsKey

public boolean containsKey(Object key)
Deprecated.

Specified by:
  `containsKey` in interface `Map<K,V>`

### containsValue

public boolean containsValue(Object value)
Deprecated.

Specified by:
  `containsValue` in interface `Map<K,V>`

### entrySet

public Set<Map.Entry<K,V>> entrySet()
Deprecated.

Specified by:
  `entrySet` in interface `Map<K,V>`

### keySet

public Set<K> keySet()
Deprecated.

Specified by:
  `keySet` in interface `Map<K,V>`

### putAll

public void putAll(Map<? extends K, ? extends V> c)
Deprecated.

Specified by:
  `putAll` in interface `Map<K,V>`

### values

public Collection<V> values()
Deprecated.

Specified by:
  `values` in interface `Map<K,V>`