Home / Function/ compare() — netty Function Reference

compare() — netty Function Reference

Architecture documentation for the compare() function in CaseIgnoringComparator.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  8d781efd_dc6a_e135_e27a_801800c9237b["compare()"]
  21b254d0_037f_fd41_8caf_d1200f0ab77d["CaseIgnoringComparator"]
  8d781efd_dc6a_e135_e27a_801800c9237b -->|defined in| 21b254d0_037f_fd41_8caf_d1200f0ab77d
  style 8d781efd_dc6a_e135_e27a_801800c9237b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/multipart/CaseIgnoringComparator.java lines 30–51

    @Override
    public int compare(CharSequence o1, CharSequence o2) {
        int o1Length = o1.length();
        int o2Length = o2.length();
        int min = Math.min(o1Length, o2Length);
        for (int i = 0; i < min; i++) {
            char c1 = o1.charAt(i);
            char c2 = o2.charAt(i);
            if (c1 != c2) {
                c1 = Character.toUpperCase(c1);
                c2 = Character.toUpperCase(c2);
                if (c1 != c2) {
                    c1 = Character.toLowerCase(c1);
                    c2 = Character.toLowerCase(c2);
                    if (c1 != c2) {
                        return c1 - c2;
                    }
                }
            }
        }
        return o1Length - o2Length;
    }

Subdomains

Frequently Asked Questions

What does compare() do?
compare() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/multipart/CaseIgnoringComparator.java.
Where is compare() defined?
compare() is defined in codec-http/src/main/java/io/netty/handler/codec/http/multipart/CaseIgnoringComparator.java at line 30.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free