> On Feb 17, 2023, at 17:17, Rémy Maucherat <r...@apache.org> wrote:
> 
> On Fri, Feb 17, 2023 at 4:32 AM <li...@apache.org> wrote:
>> -        ciphers.removeAll(movedCiphers);
>> +        movedCiphers.forEach(ciphers::remove);
> 
> Ok for some of them maybe, but I don't understand why one this is better.

See:https://www.baeldung.com/java-hashset-removeall-performance 
<https://www.baeldung.com/java-hashset-removeall-performance>
It’s just possible to avoid some potential performance issues. So i replaced 
old writing style with this. :)

Han
> Rémy
> 
>>         ciphers.addAll(movedCiphers);
>>     }
>> 
>> @@ -582,7 +582,7 @@ public class OpenSSLCipherConfigurationParser {
>>     }
>> 
>>     static void remove(final Set<Cipher> ciphers, final String alias) {
>> -        ciphers.removeAll(aliases.get(alias));
>> +        aliases.get(alias).forEach(ciphers::remove);
>>     }
>> 
>>     static LinkedHashSet<Cipher> strengthSort(final LinkedHashSet<Cipher> 
>> ciphers) {
>> diff --git a/java/org/apache/tomcat/util/scan/AbstractInputStreamJar.java 
>> b/java/org/apache/tomcat/util/scan/AbstractInputStreamJar.java
>> index 148f57ab58..fa685ba81d 100644
>> --- a/java/org/apache/tomcat/util/scan/AbstractInputStreamJar.java
>> +++ b/java/org/apache/tomcat/util/scan/AbstractInputStreamJar.java
>> @@ -67,9 +67,9 @@ public abstract class AbstractInputStreamJar implements 
>> Jar {
>>                 // Skip base entries where there is a multi-release entry
>>                 // Skip multi-release entries that are not being used
>>                 while (entry != null &&
>> -                        (mrMap.keySet().contains(entry.getName()) ||
>> +                        (mrMap.containsKey(entry.getName()) ||
>>                                 
>> entry.getName().startsWith("META-INF/versions/") &&
>> -                                !mrMap.values().contains(entry.getName()))) 
>> {
>> +                                !mrMap.containsValue(entry.getName()))) {
>>                     entry = jarInputStream.getNextJarEntry();
>>                 }
>>             } else {
>> diff --git a/java/org/apache/tomcat/util/xreflection/ReflectionProperty.java 
>> b/java/org/apache/tomcat/util/xreflection/ReflectionProperty.java
>> index f6b94ef71c..2036af9f2a 100644
>> --- a/java/org/apache/tomcat/util/xreflection/ReflectionProperty.java
>> +++ b/java/org/apache/tomcat/util/xreflection/ReflectionProperty.java
>> @@ -116,11 +116,9 @@ final class ReflectionProperty implements 
>> Comparable<ReflectionProperty> {
>> 
>>     @Override
>>     public String toString() {
>> -        final StringBuffer sb = new StringBuffer("ReflectionProperty{");
>> -        sb.append("name='").append(propertyName).append('\'');
>> -        sb.append(", type=").append(propertyType);
>> -        sb.append('}');
>> -        return sb.toString();
>> +        return "ReflectionProperty{" + "name='" + propertyName + '\'' +
>> +            ", type=" + propertyType +
>> +            '}';
>>     }
>> 
>>     @Override
>> diff --git a/java/org/apache/tomcat/util/xreflection/SetPropertyClass.java 
>> b/java/org/apache/tomcat/util/xreflection/SetPropertyClass.java
>> index a0a0146048..2011510432 100644
>> --- a/java/org/apache/tomcat/util/xreflection/SetPropertyClass.java
>> +++ b/java/org/apache/tomcat/util/xreflection/SetPropertyClass.java
>> @@ -118,10 +118,8 @@ final class SetPropertyClass implements 
>> Comparable<SetPropertyClass> {
>> 
>>     @Override
>>     public String toString() {
>> -        final StringBuffer sb = new StringBuffer("SetPropertyClass{");
>> -        sb.append("clazz=").append(clazz.getName());
>> -        sb.append('}');
>> -        return sb.toString();
>> +        return "SetPropertyClass{" + "clazz=" + clazz.getName() +
>> +            '}';
>>     }
>> 
>>     public void addProperty(ReflectionProperty property) {
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: dev-h...@tomcat.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 

Reply via email to