org.apache.commons.collections4.sequence

## Class KeepCommand<T>

- java.lang.Object
- - org.apache.commons.collections4.sequence.EditCommand<T>
  - - org.apache.commons.collections4.sequence.KeepCommand<T>

-     public class KeepCommand<T>
      extends EditCommand<T>

  Command representing the keeping of one object present in both sequences.

  When one object of the first sequence `equals` another objects in the second 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 keeping of this object. The objects embedded in these type of commands always come from the first sequence.

  Since:
    4.0
  See Also:
    `SequencesComparator`, `EditScript`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `KeepCommand(T object)` Simple constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `accept(CommandVisitor<T> visitor)` Accept a visitor.

    - ### Methods inherited from class org.apache.commons.collections4.sequence.EditCommand

      `getObject`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### KeepCommand

          public KeepCommand(T object)

      Simple constructor. Creates a new instance of KeepCommand
      Parameters:
        `object` - the object belonging to both sequences (the object is a reference to the instance in the first sequence which is known to be equal to an instance in the second sequence)

  - ### Method Detail

    - #### accept

          public void accept(CommandVisitor<T> visitor)

      Accept a visitor. When a `KeepCommand` accepts a visitor, it calls its `visitKeepCommand` method.
      Specified by:
        `accept` in class `EditCommand<T>`
      Parameters:
        `visitor` - the visitor to be accepted

Copyright © 2001–2018 The Apache Software Foundation. All rights reserved.