SimilarityInput (Apache Commons Text 1.13.0 API)
Description: declaration: package: org.apache.commons.text.similarity, interface: SimilarityInput

Package org.apache.commons.text.similarity

# Interface SimilarityInput<E>

Type Parameters:
  `E` - the type of elements in this input.

public interface SimilarityInput<E>
An ordered input of elements used to compute a similarity score.

You can implement a SimilarityInput on a domain object instead of CharSequence where implementing CharSequence does not make sense.

Since:
  1.13.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `E`
  `at(int index)`
  Gets the element in the input at the given 0-based index.
  `static SimilarityInput<Character>`
  `input(CharSequence cs)`
  Creates a new input for a `CharSequence`.
  `static <T> SimilarityInput<T>`
  `input(Object input)`
  Creates a new input for a `CharSequence` or `SimilarityInput`.
  `int`
  `length()`
  Gets the length of the input.

- ## Method Details

  - ### input

    static SimilarityInput<Character> input(CharSequence cs)
    Creates a new input for a `CharSequence`.
    Parameters:
      `cs` - input character sequence.
    Returns:
      a new input.

  - ### input

    static <T> SimilarityInput<T> input(Object input)
    Creates a new input for a `CharSequence` or `SimilarityInput`.
    Type Parameters:
      `T` - The type of similarity score unit.
    Parameters:
      `input` - character sequence or similarity input.
    Returns:
      a new input.
    Throws:
      `IllegalArgumentException` - when the input type is neither `CharSequence` or `SimilarityInput`.

  - ### at

    E at(int index)
    Gets the element in the input at the given 0-based index.
    Parameters:
      `index` - a 0-based index.
    Returns:
      the element in the input at the given 0-based index.

  - ### length

    int length()
    Gets the length of the input.
    Returns:
      the length of the input.