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

Generic tracker of items, based on a simple history queue \(get last, get next\) model. 

 Typically, such objects are long\-lived; internally, references to items are strong. Therefore, it is up to the user to make sure that referenced objects are not prevented from being garbage collected, should they be.

## Constructor: ItemHistory

Description: Create a history of 1 with a capacity of 100 and `cleanHistoryAfterIndex` set to true.

## Constructor: ItemHistory
- parameter: `capacity`, type: `int`
- parameter: `cleanHistoryAfterIndex`, type: `boolean`

Description: Create a history object with the
parameter: capacity: maximum capacity, must be at least 1
parameter: cleanHistoryAfterIndex: if true, recording an element into the history when the history            index is not at the top will erase all elements after the index and add the new            item at the top; if false, the item is inserted at the top regardless of where the            history index was

## Method: add
- parameter: `item`, type: `T`

Description: Add an item to the history. Note that any next item may be removed \(based on cleanHistoryAfterIndex constructor parameter, in particular, if [#getPrevious()](#getPrevious()) method was called without restoring position\)
parameter: item: 

## Method: addAll
- parameter: `items`, type: `java.util.Collection<T>`


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

Description: Get the history maximum capacity.
return: 

## Method: capacity
- parameter: `capacity`, type: `int`

Description: Update the history capacity.
parameter: capacity: 

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

Description: Retrieve a copy of the history items. The first item in the returned list is the oldest one.

## Method: getAt
- parameter: `newIndex`, type: `int`
- parameter: `updatedItem`, type: `T`
- return type: `T`

Description: Set the position of the History at a particular index.
parameter: newIndex: The new index of the history
return: The current item at this index.

## Method: getMostRecent
- return type: `T`


## Method: getNext
- return type: `T`


## Method: getNext
- parameter: `updatedItem`, type: `T`
- return type: `T`


## Method: getPrevious
- return type: `T`


## Method: getPrevious
- parameter: `updatedItem`, type: `T`
- return type: `T`


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


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


## Method: peekNext
- return type: `T`


## Method: peekPrevious
- return type: `T`


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

Description: Get the current history index. Navigating the history using getNext\(\), getPrevious\(\), or modifying the history using add\(\),remove\(\), etc. updates this pointer.
return: 

## Method: remove
- parameter: `item`, type: `T`
- return type: `boolean`


## Method: reset


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


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


