< prev index next >

src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/WildcardTypeImpl.java

Print this page

        

@@ -30,10 +30,11 @@
 import java.lang.reflect.WildcardType;
 import sun.reflect.generics.factory.GenericsFactory;
 import sun.reflect.generics.tree.FieldTypeSignature;
 import sun.reflect.generics.visitor.Reifier;
 import java.util.Arrays;
+import java.util.StringJoiner;
 
 
 /**
  * Implementation of WildcardType interface for core reflection.
  */

@@ -154,18 +155,16 @@
                 return "?";
         }
 
         assert bounds.length > 0;
 
-        boolean first = true;
+        StringJoiner sj = new StringJoiner(" & ");
         for(Type bound: bounds) {
-            if (!first)
-                sb.append(" & ");
-
-            first = false;
-            sb.append(bound.getTypeName());
+            sj.add(bound.getTypeName());
         }
+        sb.append(sj.toString());
+
         return sb.toString();
     }
 
     @Override
     public boolean equals(Object o) {
< prev index next >