Package org.jacoco.core.analysis

## Class NodeComparator

- java.lang.Object
- - org.jacoco.core.analysis.NodeComparator

All Implemented Interfaces:
  `java.io.Serializable`, `java.util.Comparator<ICoverageNode>`

    public class NodeComparator
    extends java.lang.Object
    implements java.util.Comparator<ICoverageNode>, java.io.Serializable

Comparator to compare `ICoverageNode` objects by different counter criteria.

See Also:
  `CounterComparator.on(ICoverageNode.CounterEntity)`, Serialized Form

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `compare​(ICoverageNode n1, ICoverageNode n2)`
`NodeComparator` `second​(java.util.Comparator<ICoverageNode> second)` Creates a new composite comparator with a second search criterion.
`<T extends ICoverageNode> java.util.List<T>` `sort​(java.util.Collection<T> summaries)` Returns a sorted copy of the given collection of `ICoverageNode` elements.

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

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

### Methods inherited from interface java.util.Comparator

`equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

### Method Detail

#### second

    public NodeComparator second​(java.util.Comparator<ICoverageNode> second)

Creates a new composite comparator with a second search criterion.

Parameters:
  `second` - second criterion comparator
Returns:
  composite comparator

#### sort

    public <T extends ICoverageNode> java.util.List<T> sort​(java.util.Collection<T> summaries)

Returns a sorted copy of the given collection of `ICoverageNode` elements.

Type Parameters:
  `T` - actual type of the elements
Parameters:
  `summaries` - collection to create a copy of
Returns:
  sorted copy

#### compare

    public int compare​(ICoverageNode n1,
                       ICoverageNode n2)

Specified by:
  `compare` in interface `java.util.Comparator<ICoverageNode>`