Improve performance in ProtocolVersionRange#contains (#3964)

This commit is contained in:
EnZaXD 2024-06-22 11:02:16 +02:00 committed by GitHub
parent b67ebecce8
commit 9d3db4cf97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -104,7 +104,10 @@ public class ProtocolVersionRange {
*/
public boolean contains(final ProtocolVersion version) {
if (this.ranges == null) return true;
return this.ranges.stream().anyMatch(range -> range.contains(version));
for (Range<ProtocolVersion> range : this.ranges) {
if (range.contains(version)) return true;
}
return false;
}
@Override