## org.apache.lucene.search.suggest
Class BytesRefList

    java.lang.Object
      org.apache.lucene.search.suggest.BytesRefList

    public final class BytesRefList

extends Object

A simple append only random-access `BytesRef` array that stores full copies of the appended bytes in a `ByteBlockPool`. Note: This class is not Thread-Safe!

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

Constructor Summary
`BytesRefList()` Creates a new `BytesRefList`

Method Summary
`int` `append(org.apache.lucene.util.BytesRef bytes)` Appends a copy of the given `BytesRef` to this `BytesRefList`.
`long` `bytesUsed()` Returns the number internally used bytes to hold the appended bytes in memory
`void` `clear()` Clears this `BytesRefList`
`org.apache.lucene.util.BytesRef` `get(org.apache.lucene.util.BytesRef spare, int ord)` Returns the n'th element of this `BytesRefList`
`org.apache.lucene.util.BytesRefIterator` `iterator()` sugar for `iterator(Comparator)` with a `null` comparator
`org.apache.lucene.util.BytesRefIterator` `iterator(Comparator<org.apache.lucene.util.BytesRef> comp)` Returns a `BytesRefIterator` with point in time semantics.
`int` `size()` Returns the current size of this `BytesRefList`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BytesRefList

    public BytesRefList()

  Creates a new `BytesRefList`

Method Detail

### clear

    public void clear()

  Clears this `BytesRefList`

### append

    public int append(org.apache.lucene.util.BytesRef bytes)

  Appends a copy of the given `BytesRef` to this `BytesRefList`.

  Parameters:
    `bytes` - the bytes to append
  Returns:
    the ordinal of the appended bytes

### size

    public int size()

  Returns the current size of this `BytesRefList`

  Returns:
    the current size of this `BytesRefList`

### get

    public org.apache.lucene.util.BytesRef get(org.apache.lucene.util.BytesRef spare,
                                               int ord)

  Returns the n'th element of this `BytesRefList`

  Parameters:
    `spare` - a spare `BytesRef` instance
    `ord` - the elements ordinal to retrieve
  Returns:
    the n'th element of this `BytesRefList`

### bytesUsed

    public long bytesUsed()

  Returns the number internally used bytes to hold the appended bytes in memory

  Returns:
    the number internally used bytes to hold the appended bytes in memory

### iterator

    public org.apache.lucene.util.BytesRefIterator iterator()

  sugar for `iterator(Comparator)` with a `null` comparator

### iterator

    public org.apache.lucene.util.BytesRefIterator iterator(Comparator<org.apache.lucene.util.BytesRef> comp)

  Returns a `BytesRefIterator` with point in time semantics. The iterator provides access to all so far appended `BytesRef` instances.

  If a non `null` `Comparator` is provided the iterator will iterate the byte values in the order specified by the comparator. Otherwise the order is the same as the values were appended.

  This is a non-destructive operation.