UniqFilter (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.filters, class: UniqFilter

# Class UniqFilter

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.filters.TokenFilter.ChainableReaderFilter
org.apache.tools.ant.filters.UniqFilter

All Implemented Interfaces:
  `Cloneable, ChainableReader, TokenFilter.Filter`

public class UniqFilter extends TokenFilter.ChainableReaderFilter
Like the Unix uniq(1) command, only returns tokens that are different from their ancestor token.

This filter is probably most useful if used together with a sortfilter.

Since:
  Ant 1.8.0

- ## Field Summary

  ### Fields inherited from class ProjectComponent

  `description, location, project`
  Modifier and Type
  Field
  Description
  `protected String`
  `description`
  Deprecated.
  since 1.6.x.
  `protected Location`
  `location`
  Deprecated.
  since 1.6.x.
  `protected Project`
  `project`
  Deprecated.
  since 1.6.x.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UniqFilter()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `filter(String string)`
  filter and/of modify a string

  ### Methods inherited from class TokenFilter.ChainableReaderFilter

  `chain, setByLine`
  Modifier and Type
  Method
  Description
  `Reader`
  `chain(Reader reader)`
  Chain a tokenfilter reader to a reader,
  `void`
  `setByLine(boolean byLine)`
  set whether to use filetokenizer or line tokenizer

  ### Methods inherited from class ProjectComponent

  `clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject`
  Modifier and Type
  Method
  Description
  `Object`
  `clone()`
  `String`
  `getDescription()`
  Returns the description of the current action.
  `Location`
  `getLocation()`
  Returns the file/location where this task was defined.
  `Project`
  `getProject()`
  Returns the project to which this component belongs.
  `void`
  `log(String msg)`
  Logs a message with the default (INFO) priority.
  `void`
  `log(String msg, int msgLevel)`
  Logs a message with the given priority.
  `void`
  `setDescription(String desc)`
  Sets a description of the current action.
  `void`
  `setLocation(Location location)`
  Sets the file/location where this task was defined.
  `void`
  `setProject(Project project)`
  Sets the project object of this component.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### UniqFilter

    public UniqFilter()

- ## Method Details

  - ### filter

    public String filter(String string)
    Description copied from interface: `TokenFilter.Filter`
    filter and/of modify a string
    Parameters:
      `string` - the string to filter
    Returns:
      the modified string or null if the string did not pass the filter