Class CookieIdentityComparator

java.lang.Object
org.apache.http.cookie.CookieIdentityComparator
All Implemented Interfaces:
Serializable, Comparator<Cookie>

public class CookieIdentityComparator
extends Object
implements Serializable, Comparator<Cookie>
This cookie comparator can be used to compare identity of cookies.

Cookies are considered identical if their names are equal and their domain attributes match ignoring case.

Author:
Oleg Kalnichevski
See Also:
Serialized Form
  • Constructor Details

    • CookieIdentityComparator

      public CookieIdentityComparator()
  • Method Details

    • compare

      public int compare​(Cookie c1, Cookie c2)
      Description copied from interface: Comparator
      Compares the two specified objects to determine their relative ordering. The ordering implied by the return value of this method for all possible pairs of (lhs, rhs) should form an equivalence relation. This means that
      • compare(a,a) returns zero for all a
      • the sign of compare(a,b) must be the opposite of the sign of compare(b,a) for all pairs of (a,b)
      • From compare(a,b) > 0 and compare(b,c) > 0 it must follow compare(a,c) > 0 for all possible combinations of (a,b,c)
      Specified by:
      compare in interface Comparator<Cookie>
      Parameters:
      c1 - an Object.
      c2 - a second Object to compare with lhs.
      Returns:
      an integer < 0 if lhs is less than rhs, 0 if they are equal, and > 0 if lhs is greater than rhs.