< prev index next >

src/java.base/share/classes/java/lang/Character.java

Print this page
rev 52948 : 8215194: Initial size of UnicodeBlock map is incorrect
Reviewed-by: rriggs, rgoel


 664          * Returns the name of this subset.
 665          */
 666         public final String toString() {
 667             return name;
 668         }
 669     }
 670 
 671     // See http://www.unicode.org/Public/UNIDATA/Blocks.txt
 672     // for the latest specification of Unicode Blocks.
 673 
 674     /**
 675      * A family of character subsets representing the character blocks in the
 676      * Unicode specification. Character blocks generally define characters
 677      * used for a specific script or purpose. A character is contained by
 678      * at most one Unicode block.
 679      *
 680      * @since 1.2
 681      */
 682     public static final class UnicodeBlock extends Subset {
 683         /**
 684          * 649  - the expected number of entities
 685          * 0.75 - the default load factor of HashMap
 686          */

 687         private static Map<String, UnicodeBlock> map =
 688                 new HashMap<>((int)(649 / 0.75f + 1.0f));
 689 
 690         /**
 691          * Creates a UnicodeBlock with the given identifier name.
 692          * This name must be the same as the block identifier.
 693          */
 694         private UnicodeBlock(String idName) {
 695             super(idName);
 696             map.put(idName, this);
 697         }
 698 
 699         /**
 700          * Creates a UnicodeBlock with the given identifier name and
 701          * alias name.
 702          */
 703         private UnicodeBlock(String idName, String alias) {
 704             this(idName);
 705             map.put(alias, this);
 706         }
 707 
 708         /**




 664          * Returns the name of this subset.
 665          */
 666         public final String toString() {
 667             return name;
 668         }
 669     }
 670 
 671     // See http://www.unicode.org/Public/UNIDATA/Blocks.txt
 672     // for the latest specification of Unicode Blocks.
 673 
 674     /**
 675      * A family of character subsets representing the character blocks in the
 676      * Unicode specification. Character blocks generally define characters
 677      * used for a specific script or purpose. A character is contained by
 678      * at most one Unicode block.
 679      *
 680      * @since 1.2
 681      */
 682     public static final class UnicodeBlock extends Subset {
 683         /**
 684          * 667  - the expected number of entities
 685          * 0.75 - the default load factor of HashMap
 686          */
 687         private static final int NUM_ENTITIES = 667;
 688         private static Map<String, UnicodeBlock> map =
 689                 new HashMap<>((int)(NUM_ENTITIES / 0.75f + 1.0f));
 690 
 691         /**
 692          * Creates a UnicodeBlock with the given identifier name.
 693          * This name must be the same as the block identifier.
 694          */
 695         private UnicodeBlock(String idName) {
 696             super(idName);
 697             map.put(idName, this);
 698         }
 699 
 700         /**
 701          * Creates a UnicodeBlock with the given identifier name and
 702          * alias name.
 703          */
 704         private UnicodeBlock(String idName, String alias) {
 705             this(idName);
 706             map.put(alias, this);
 707         }
 708 
 709         /**


< prev index next >