compareTo() — netty Function Reference
Architecture documentation for the compareTo() function in DefaultChannelId.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 591edfaf_0e7e_48ab_0eb0_f09c4447b3fa["compareTo()"] 20dcb0e9_635a_927e_e4b0_31b79bc84709["DefaultChannelId"] 591edfaf_0e7e_48ab_0eb0_f09c4447b3fa -->|defined in| 20dcb0e9_635a_927e_e4b0_31b79bc84709 style 591edfaf_0e7e_48ab_0eb0_f09c4447b3fa fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/DefaultChannelId.java lines 299–324
@Override
public int compareTo(final ChannelId o) {
if (this == o) {
// short circuit
return 0;
}
if (o instanceof DefaultChannelId) {
// lexicographic comparison
final byte[] otherData = ((DefaultChannelId) o).data;
int len1 = data.length;
int len2 = otherData.length;
int len = Math.min(len1, len2);
for (int k = 0; k < len; k++) {
byte x = data[k];
byte y = otherData[k];
if (x != y) {
// treat these as unsigned bytes for comparison
return (x & 0xff) - (y & 0xff);
}
}
return len1 - len2;
}
return asLongText().compareTo(o.asLongText());
}
Domain
Subdomains
Source
Frequently Asked Questions
What does compareTo() do?
compareTo() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/DefaultChannelId.java.
Where is compareTo() defined?
compareTo() is defined in transport/src/main/java/io/netty/channel/DefaultChannelId.java at line 299.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free