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

A trie map specialized to handle context\-free \(CF\) binary strings. Context\-free here means that the binary strings stored as keys cannot be such that, given a binary string A, there exists a longer binary string B whose prefix is A. 

 Characteristics/limitations:
 \- Support for insertion and retrieval only \(no removal\).
 \- The null key and the empty key are illegal.
 \- Null values are illegal.
 

 This class is not thread\-safe. This class does not override equals/hashCode/toString. 

 Implementation notes: the is serializable \(at the condition that the stored objects T are also serializable\). In order to serialize this class efficiently, both in terms of space and time, a [key extractor](#setKeyExtractor(IKeyExtractor)) should be set.

## Constructor: CFBytesTrie


## Method: clear


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


## Method: get
- parameter: `key`, type: `byte[]`
- parameter: `exactKey`, type: `boolean`
- return type: `T`

Description: Retrieve a value in the trie.
parameter: key: key
parameter: exactKey: 
return: object value, null if none

## Method: get
- parameter: `keyarray`, type: `byte[]`
- parameter: `start`, type: `int`
- parameter: `max`, type: `int`
- parameter: `exactKey`, type: `boolean`
- return type: `T`

Description: Retrieve a value in the trie.
parameter: keyarray: key array
parameter: start: key start index
parameter: max: key end index \(exclusive\)
parameter: exactKey: if false, more potential key bytes may be provided, and the object whose key            matches the beginning of the sequence of bytes will be returned
return: object value, null if none

## Method: getItems
- return type: `java.util.List<com.pnfsoftware.jeb.util.base.Couple<byte[],T>>`

Description: Generate the list of items \(key, value\) stored in this trie. This method is potentially expensive.
return: 

## Method: getKeyExtractor
- return type: `com.pnfsoftware.jeb.util.collect.CFBytesTrie.IKeyExtractor<T>`


## Method: getValues
- return type: `java.util.List<T>`

Description: Generate a list of all values stored in this trie. This method is potentially expensive.
return: 

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


## Method: put
- parameter: `object`, type: `T`

Description: Add a new entry to the trie. This method throws an [IllegalStateException](IllegalStateException) on prefix collision.
parameter: object: value \(the value's key is derived using the key extractor\)

## Method: put
- parameter: `key`, type: `byte[]`
- parameter: `object`, type: `T`

Description: Add a new entry to the trie. This method throws an [IllegalStateException](IllegalStateException) on prefix collision.
parameter: key: key
parameter: object: value

## Method: put
- parameter: `keyarray`, type: `byte[]`
- parameter: `start`, type: `int`
- parameter: `end`, type: `int`
- parameter: `object`, type: `T`
- return type: `T`

Description: Add a new entry to the trie. This method throws an [IllegalStateException](IllegalStateException) on prefix collision.
parameter: keyarray: key array
parameter: start: key start position in the array
parameter: end: key end position \(exclusive\)
parameter: object: value
return: the previous entry at key, null if none

## Method: putSafe
- parameter: `keyarray`, type: `byte[]`
- parameter: `start`, type: `int`
- parameter: `end`, type: `int`
- parameter: `object`, type: `T`
- parameter: `aprev`, type: `T[]`
- return type: `boolean`

Description: Add a new entry to the trie. This method does not throw if a prefix collision is detected; instead, false is returned.
parameter: keyarray: key array
parameter: start: key start position in the array
parameter: end: key end position \(exclusive\)
parameter: object: value
parameter: aprev: if non\-null, a one\-element array that will receive the previous entry at key, or            null if none
return: success indicator \(false if a prefix collision occurred\)

## Method: setKeyExtractor
- parameter: `keyExtractor`, type: `com.pnfsoftware.jeb.util.collect.CFBytesTrie.IKeyExtractor<T>`


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


