org.apache.hc.client5.http.cookie

## Class CookiePathComparator

- java.lang.Object
- - org.apache.hc.client5.http.cookie.CookiePathComparator

- All Implemented Interfaces:
    Serializable, Comparator<Cookie>

      @Contract(threading=STATELESS)
      public class CookiePathComparator
      extends Object
      implements Serializable, Comparator<Cookie>

  This cookie comparator ensures that multiple cookies satisfying a common criteria are ordered in the `Cookie` header such that those with more specific Path attributes precede those with less specific.

  This comparator assumes that Path attributes of two cookies path-match a common request-URI. Otherwise, the result of the comparison is undefined.

  Since:
    4.0
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static CookiePathComparator` | `INSTANCE` Default instance of `CookiePathComparator`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CookiePathComparator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compare(Cookie c1, Cookie c2)`

    - ### 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

      `comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### Field Detail

    - #### INSTANCE

          public static final CookiePathComparator INSTANCE

      Default instance of `CookiePathComparator`.

  - ### Constructor Detail

    - #### CookiePathComparator

          public CookiePathComparator()

  - ### Method Detail

    - #### compare

          public int compare(Cookie c1,
                             Cookie c2)

      Specified by:
        `compare` in interface `Comparator<Cookie>`

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.