< prev index next >

src/java.base/share/classes/java/util/jar/Attributes.java

Print this page




 496         /**
 497          * Compares this attribute name to another for equality.
 498          * @param o the object to compare
 499          * @return true if this attribute name is equal to the
 500          *         specified attribute object
 501          */
 502         public boolean equals(Object o) {
 503             if (o instanceof Name) {
 504                 Comparator<String> c = String.CASE_INSENSITIVE_ORDER;
 505                 return c.compare(name, ((Name)o).name) == 0;
 506             } else {
 507                 return false;
 508             }
 509         }
 510 
 511         /**
 512          * Computes the hash value for this attribute name.
 513          */
 514         public int hashCode() {
 515             if (hashCode == -1) {
 516                 hashCode = name.toLowerCase(Locale.ROOT).hashCode();
 517             }
 518             return hashCode;
 519         }
 520 
 521         /**
 522          * Returns the attribute name as a String.
 523          */
 524         public String toString() {
 525             return name;
 526         }
 527 
 528         /**
 529          * {@code Name} object for {@code Manifest-Version}
 530          * manifest attribute. This attribute indicates the version number
 531          * of the manifest standard to which a JAR file's manifest conforms.
 532          * @see <a href="../../../../technotes/guides/jar/jar.html#JAR_Manifest">
 533          *      Manifest and Signature Specification</a>
 534          */
 535         public static final Name MANIFEST_VERSION = new Name("Manifest-Version");
 536 




 496         /**
 497          * Compares this attribute name to another for equality.
 498          * @param o the object to compare
 499          * @return true if this attribute name is equal to the
 500          *         specified attribute object
 501          */
 502         public boolean equals(Object o) {
 503             if (o instanceof Name) {
 504                 Comparator<String> c = String.CASE_INSENSITIVE_ORDER;
 505                 return c.compare(name, ((Name)o).name) == 0;
 506             } else {
 507                 return false;
 508             }
 509         }
 510 
 511         /**
 512          * Computes the hash value for this attribute name.
 513          */
 514         public int hashCode() {
 515             if (hashCode == -1) {
 516                 hashCode = String.CASE_INSENSITIVE_HASHER.applyAsInt(name);
 517             }
 518             return hashCode;
 519         }
 520 
 521         /**
 522          * Returns the attribute name as a String.
 523          */
 524         public String toString() {
 525             return name;
 526         }
 527 
 528         /**
 529          * {@code Name} object for {@code Manifest-Version}
 530          * manifest attribute. This attribute indicates the version number
 531          * of the manifest standard to which a JAR file's manifest conforms.
 532          * @see <a href="../../../../technotes/guides/jar/jar.html#JAR_Manifest">
 533          *      Manifest and Signature Specification</a>
 534          */
 535         public static final Name MANIFEST_VERSION = new Name("Manifest-Version");
 536 


< prev index next >