# Class InsertCommand<T>

java.lang.Object
org.apache.commons.text.diff.EditCommand<T>
org.apache.commons.text.diff.InsertCommand<T>

Type Parameters:
  `T` - object type

public class InsertCommand<T> extends EditCommand<T>
Command representing the insertion of one object of the second sequence.

When one object of the second sequence has no corresponding object in the first sequence at the right place, the `edit script` transforming the first sequence into the second sequence uses an instance of this class to represent the insertion of this object. The objects embedded in these type of commands always come from the second sequence.

Since:
  1.0
See Also:
  - `StringsComparator`
  - `EditScript`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InsertCommand(T object)`
  Constructs a new instance of InsertCommand.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `accept(CommandVisitor<T> visitor)`
  Accepts a visitor.

  ### Methods inherited from class EditCommand

  `getObject`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### InsertCommand

    public InsertCommand(T object)
    Constructs a new instance of InsertCommand.
    Parameters:
      `object` - the object of the second sequence that should be inserted.

- ## Method Details

  - ### accept

    public void accept(CommandVisitor<T> visitor)
    Accepts a visitor. When an `InsertCommand` accepts a visitor, it calls its `visitInsertCommand` method.
    Specified by:
      `accept` in class `EditCommand<T>`
    Parameters:
      `visitor` - the visitor to be accepted.