src/java.naming/share/classes/javax/naming/directory/BasicAttribute.java

Print this page
rev 10537 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


 194                         if (it != null) {
 195                             hash += it.hashCode();
 196                         }
 197                     }
 198                 } else {
 199                     hash += val.hashCode();
 200                 }
 201             }
 202         }
 203         return hash;
 204     }
 205 
 206     /**
 207       * Generates the string representation of this attribute.
 208       * The string consists of the attribute's id and its values.
 209       * This string is meant for debugging and not meant to be
 210       * interpreted programmatically.
 211       * @return The non-null string representation of this attribute.
 212       */
 213     public String toString() {
 214         StringBuilder answer = new StringBuilder(attrID + ": ");

 215         if (values.size() == 0) {
 216             answer.append("No values");
 217         } else {
 218             boolean start = true;
 219             for (Enumeration<Object> e = values.elements(); e.hasMoreElements(); ) {
 220                 if (!start)
 221                     answer.append(", ");
 222                 answer.append(e.nextElement());
 223                 start = false;
 224             }
 225         }
 226         return answer.toString();
 227     }
 228 
 229     /**
 230       * Constructs a new instance of an unordered attribute with no value.
 231       *
 232       * @param id The attribute's id. It cannot be null.
 233       */
 234     public BasicAttribute(String id) {




 194                         if (it != null) {
 195                             hash += it.hashCode();
 196                         }
 197                     }
 198                 } else {
 199                     hash += val.hashCode();
 200                 }
 201             }
 202         }
 203         return hash;
 204     }
 205 
 206     /**
 207       * Generates the string representation of this attribute.
 208       * The string consists of the attribute's id and its values.
 209       * This string is meant for debugging and not meant to be
 210       * interpreted programmatically.
 211       * @return The non-null string representation of this attribute.
 212       */
 213     public String toString() {
 214         StringBuilder answer = new StringBuilder();
 215         answer.append(attrID).append(": ");
 216         if (values.size() == 0) {
 217             answer.append("No values");
 218         } else {
 219             boolean start = true;
 220             for (Enumeration<Object> e = values.elements(); e.hasMoreElements(); ) {
 221                 if (!start)
 222                     answer.append(", ");
 223                 answer.append(e.nextElement());
 224                 start = false;
 225             }
 226         }
 227         return answer.toString();
 228     }
 229 
 230     /**
 231       * Constructs a new instance of an unordered attribute with no value.
 232       *
 233       * @param id The attribute's id. It cannot be null.
 234       */
 235     public BasicAttribute(String id) {