类java.text.CollationKey源码实例Demo

下面列出了怎么用java.text.CollationKey的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dragonwell8_jdk   文件: CollationKeyTestImpl.java
private  void  InsertionSort(CollationKey[] keys){
    int f, i;
    CollationKey tmp;

    for (f=1; f < keys.length; f++){
        if(keys[f].compareTo( keys[f-1]) > 0){
            continue;
        }
        tmp = keys[f];
        i = f-1;
        while ( (i>=0) && (keys[i].compareTo(tmp) > 0) ) {
            keys[i+1] = keys[i];
            i--;
        }
        keys[i+1]=tmp;
    }
}
 
源代码2 项目: TencentKona-8   文件: CollationKeyTestImpl.java
private  void  InsertionSort(CollationKey[] keys){
    int f, i;
    CollationKey tmp;

    for (f=1; f < keys.length; f++){
        if(keys[f].compareTo( keys[f-1]) > 0){
            continue;
        }
        tmp = keys[f];
        i = f-1;
        while ( (i>=0) && (keys[i].compareTo(tmp) > 0) ) {
            keys[i+1] = keys[i];
            i--;
        }
        keys[i+1]=tmp;
    }
}
 
/** @see SQLChar#stringCompare(SQLChar, SQLChar) */
int stringCompare(SQLChar str1, SQLChar str2)
throws StandardException
{
	CollationKey ckey1 = str1.getCollationKey();
	CollationKey ckey2 = str2.getCollationKey();
	
	/*
	** By convention, nulls sort High, and null == null
	*/
	if (ckey1 == null || ckey2 == null)
	{
		if (ckey1 != null)	// str2 == null
			return -1;
		if (ckey2 != null)	// this == null
			return 1;
		return 0;			// both == null
	}

	return ckey1.compareTo(ckey2);
}
 
源代码4 项目: spliceengine   文件: SQLChar.java
@SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "DB-9406")
public void    copyState
    (
     String otherValue,
     char[] otherRawData,
     int otherRawLength,
     CollationKey otherCKey,
     InputStream    otherStream,
     Clob otherClobValue,
     LocaleFinder otherLocaleFinder
     )
{
    value = otherValue;
    rawData = otherRawData;
    rawLength = otherRawLength;
    cKey = otherCKey;
    stream = otherStream;
    _clobValue = otherClobValue;
    localeFinder = otherLocaleFinder;
    isNull = evaluateNull();
}
 
源代码5 项目: openjdk-jdk8u   文件: CollationKeyTestImpl.java
private  void  InsertionSort(CollationKey[] keys){
    int f, i;
    CollationKey tmp;

    for (f=1; f < keys.length; f++){
        if(keys[f].compareTo( keys[f-1]) > 0){
            continue;
        }
        tmp = keys[f];
        i = f-1;
        while ( (i>=0) && (keys[i].compareTo(tmp) > 0) ) {
            keys[i+1] = keys[i];
            i--;
        }
        keys[i+1]=tmp;
    }
}
 
源代码6 项目: Android   文件: FriendCompara.java
@Override
public int compare(ContactEntity lhs, ContactEntity rhs) {
    String string1 = TextUtils.isEmpty(lhs.getRemark()) ? lhs.getUsername() : lhs.getRemark();
    String string2 = TextUtils.isEmpty(rhs.getRemark()) ? rhs.getUsername() : rhs.getRemark();

    char char1 = TextUtils.isEmpty(string1) ? '#' : string1.charAt(0);
    char char2 = TextUtils.isEmpty(string2) ? '#' : string2.charAt(0);

    CollationKey key1 = collator.getCollationKey(PinyinUtil.chatToPinyin(char1));
    CollationKey key2 = collator.getCollationKey(PinyinUtil.chatToPinyin(char2));

    // Comparison method violates its general contract
    if (key1.getSourceString().equals(key2.getSourceString())) {
        return 0;
    }
    if ("#".equals(key1.getSourceString())
            || "#".equals(key2.getSourceString())) {
        if ("#".equals(key1.getSourceString())) {
            return 1;
        } else if ("#".equals(key2.getSourceString())) {
            return -1;
        }
    }
    return key1.compareTo(key2);
}
 
源代码7 项目: Android   文件: GroupComPara.java
@Override
public int compare(GroupMemberEntity lhs, GroupMemberEntity rhs) {
    String string1 = TextUtils.isEmpty(lhs.getNick()) ? lhs.getUsername() : lhs.getNick();
    String string2 = TextUtils.isEmpty(rhs.getNick()) ? rhs.getUsername() : rhs.getNick();

    char char1 = TextUtils.isEmpty(string1) ? '#' : string1.charAt(0);
    char char2 = TextUtils.isEmpty(string2) ? '#' : string2.charAt(0);

    CollationKey key1 = collator.getCollationKey(PinyinUtil.chatToPinyin(char1));
    CollationKey key2 = collator.getCollationKey(PinyinUtil.chatToPinyin(char2));

    // Comparison method violates its general contract
    if (key1.getSourceString().equals(key2.getSourceString())) {
        return 0;
    }
    if ("#".equals(key1.getSourceString())
            || "#".equals(key2.getSourceString())) {
        if ("#".equals(key1.getSourceString())) {
            return 1;
        } else if ("#".equals(key2.getSourceString())) {
            return -1;
        }
    }
    return key1.compareTo(key2);
}
 
源代码8 项目: openjdk-jdk9   文件: CollationKeyTestImpl.java
private  void  InsertionSort(CollationKey[] keys){
    int f, i;
    CollationKey tmp;

    for (f=1; f < keys.length; f++){
        if(keys[f].compareTo( keys[f-1]) > 0){
            continue;
        }
        tmp = keys[f];
        i = f-1;
        while ( (i>=0) && (keys[i].compareTo(tmp) > 0) ) {
            keys[i+1] = keys[i];
            i--;
        }
        keys[i+1]=tmp;
    }
}
 
/** @see SQLChar#stringCompare(SQLChar, SQLChar) */
int stringCompare(SQLChar str1, SQLChar str2)
throws StandardException
{
	CollationKey ckey1 = str1.getCollationKey();
	CollationKey ckey2 = str2.getCollationKey();
	
	/*
	** By convention, nulls sort High, and null == null
	*/
	if (ckey1 == null || ckey2 == null)
	{
		if (ckey1 != null)	// str2 == null
			return -1;
		if (ckey2 != null)	// this == null
			return 1;
		return 0;			// both == null
	}

	return ckey1.compareTo(ckey2);
}
 
源代码10 项目: jdk8u_jdk   文件: CollationKeyTestImpl.java
private  void  InsertionSort(CollationKey[] keys){
    int f, i;
    CollationKey tmp;

    for (f=1; f < keys.length; f++){
        if(keys[f].compareTo( keys[f-1]) > 0){
            continue;
        }
        tmp = keys[f];
        i = f-1;
        while ( (i>=0) && (keys[i].compareTo(tmp) > 0) ) {
            keys[i+1] = keys[i];
            i--;
        }
        keys[i+1]=tmp;
    }
}
 
/** @see SQLChar#stringCompare(SQLChar, SQLChar) */
int stringCompare(SQLChar str1, SQLChar str2)
throws StandardException
{
	CollationKey ckey1 = str1.getCollationKey();
	CollationKey ckey2 = str2.getCollationKey();
	
	/*
	** By convention, nulls sort High, and null == null
	*/
	if (ckey1 == null || ckey2 == null)
	{
		if (ckey1 != null)	// str2 == null
			return -1;
		if (ckey2 != null)	// this == null
			return 1;
		return 0;			// both == null
	}

	return ckey1.compareTo(ckey2);
}
 
源代码12 项目: kkFileViewOfficeEdit   文件: ZipReader.java
@Override
public int compare(FileNode o1, FileNode o2) {
    // 判断两个对比对象是否是开头包含数字,如果包含数字则获取数字并按数字真正大小进行排序
    BigDecimal num1,num2;
    if (null != (num1 = isStartNumber(o1))
            && null != (num2 = isStartNumber(o2))) {
        return num1.subtract(num2).intValue();
    }
    CollationKey c1 = cmp.getCollationKey(o1.getOriginName());
    CollationKey c2 = cmp.getCollationKey(o2.getOriginName());
    return cmp.compare(c1.getSourceString(), c2.getSourceString());
}
 
源代码13 项目: dragonwell8_jdk   文件: APITest.java
public final void TestCollationKey( )
{
    logln("testing CollationKey begins...");
    Collator col = null;
    try {
        col = Collator.getInstance(Locale.ROOT);
    } catch (Exception foo) {
        errln("Error : " + foo.getMessage());
        errln("Default collation creation failed.");
    }
    if (col == null) {
        return;
    }

    String test1 = "Abcda", test2 = "abcda";
    logln("Use tertiary comparison level testing ....");
    CollationKey sortk1 = col.getCollationKey(test1);
    CollationKey sortk2 = col.getCollationKey(test2);
    doAssert(sortk1.compareTo(sortk2) > 0,
                "Result should be \"Abcda\" >>> \"abcda\"");
    CollationKey sortk3 = sortk2;
    CollationKey sortkNew = sortk1;
    doAssert(sortk1 != sortk2, "The sort keys should be different");
    doAssert(sortk1.hashCode() != sortk2.hashCode(), "sort key hashCode() failed");
    doAssert(sortk2.compareTo(sortk3) == 0, "The sort keys should be the same");
    doAssert(sortk1 == sortkNew, "The sort keys assignment failed");
    doAssert(sortk1.hashCode() == sortkNew.hashCode(), "sort key hashCode() failed");
    doAssert(sortkNew != sortk3, "The sort keys should be different");
    doAssert(sortk1.compareTo(sortk3) > 0, "Result should be \"Abcda\" >>> \"abcda\"");
    doAssert(sortk2.compareTo(sortk3) == 0, "Result should be \"abcda\" == \"abcda\"");
    long    cnt1, cnt2;
    byte byteArray1[] = sortk1.toByteArray();
    byte byteArray2[] = sortk2.toByteArray();
    doAssert(byteArray1 != null && byteArray2 != null, "CollationKey.toByteArray failed.");
    logln("testing sortkey ends...");
}
 
源代码14 项目: dragonwell8_jdk   文件: MonkeyTest.java
public void TestCollationKey()
{
    String source = "-abcdefghijklmnopqrstuvwxyz#&^[email protected]";
    Random r = new Random(3);
    int s = checkValue(r.nextInt() % source.length());
    int t = checkValue(r.nextInt() % source.length());
    int slen = checkValue((r.nextInt() - source.length()) % source.length());
    int tlen = checkValue((r.nextInt() - source.length()) % source.length());
    String subs = source.substring((s > slen ? slen : s), (s >= slen ? s : slen));
    String subt = source.substring((t > tlen ? tlen : t), (t >= tlen ? t : tlen));
    myCollator.setStrength(Collator.TERTIARY);
    CollationKey CollationKey1 = myCollator.getCollationKey(subs);
    CollationKey CollationKey2 = myCollator.getCollationKey(subt);
    int result = CollationKey1.compareTo(CollationKey2);  // Tertiary
    int revResult = CollationKey2.compareTo(CollationKey1);  // Tertiary
    report(("CollationKey(" + subs + ")"), ("CollationKey(" + subt + ")"), result, revResult);
    myCollator.setStrength(Collator.SECONDARY);
    CollationKey1 = myCollator.getCollationKey(subs);
    CollationKey2 = myCollator.getCollationKey(subt);
    result = CollationKey1.compareTo(CollationKey2);  // Secondary
    revResult = CollationKey2.compareTo(CollationKey1);   // Secondary
    report(("CollationKey(" + subs + ")") , ("CollationKey(" + subt + ")"), result, revResult);
    myCollator.setStrength(Collator.PRIMARY);
    CollationKey1 = myCollator.getCollationKey(subs);
    CollationKey2 = myCollator.getCollationKey(subt);
    result = CollationKey1.compareTo(CollationKey2);  // Primary
    revResult = CollationKey2.compareTo(CollationKey1);   // Primary
    report(("CollationKey(" + subs + ")"), ("CollationKey(" + subt + ")"), result, revResult);
    String addOne = subs + "\uE000";
    CollationKey1 = myCollator.getCollationKey(subs);
    CollationKey2 = myCollator.getCollationKey(addOne);
    result = CollationKey1.compareTo(CollationKey2);
    if (result != -1)
        errln("CollationKey(" + subs + ")" + ".LT." + "CollationKey(" + addOne + ") Failed.");
    result = CollationKey2.compareTo(CollationKey1);
    if (result != 1)
        errln("CollationKey(" + addOne + ")" + ".GT." + "CollationKey(" + subs + ") Failed.");
}
 
源代码15 项目: adaptive-radix-tree   文件: Collator.java
@Test
public void testICU(){
	String str = "hello";
	java.text.Collator col = java.text.Collator.getInstance(Locale.US);;
	CollationKey ck = col.getCollationKey(str);
	byte[] bytes = ck.toByteArray();
	System.out.println("collation key bytes length: " + bytes.length);
	System.out.println("collation key bytes: " + Arrays.toString(bytes));
	System.out.println("collation key as string:" + new String(bytes));
	System.out.println("original string: " + Arrays.toString(str.getBytes()));
}
 
源代码16 项目: TencentKona-8   文件: ExecutableMemberDocImpl.java
/**
 * Generate a key for sorting.
 */
@Override
CollationKey generateKey() {
    String k = name() + flatSignature() + typeParametersString();
    // ',' and '&' are between '$' and 'a':  normalize to spaces.
    k = k.replace(',', ' ').replace('&', ' ');
    // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\"");
    return env.doclocale.collator.getCollationKey(k);
}
 
源代码17 项目: TencentKona-8   文件: DocImpl.java
/**
 * return a key for sorting.
 */
CollationKey key() {
    if (collationkey == null) {
        collationkey = generateKey();
    }
    return collationkey;
}
 
源代码18 项目: TencentKona-8   文件: APITest.java
public final void TestCollationKey( )
{
    logln("testing CollationKey begins...");
    Collator col = null;
    try {
        col = Collator.getInstance(Locale.ROOT);
    } catch (Exception foo) {
        errln("Error : " + foo.getMessage());
        errln("Default collation creation failed.");
    }
    if (col == null) {
        return;
    }

    String test1 = "Abcda", test2 = "abcda";
    logln("Use tertiary comparison level testing ....");
    CollationKey sortk1 = col.getCollationKey(test1);
    CollationKey sortk2 = col.getCollationKey(test2);
    doAssert(sortk1.compareTo(sortk2) > 0,
                "Result should be \"Abcda\" >>> \"abcda\"");
    CollationKey sortk3 = sortk2;
    CollationKey sortkNew = sortk1;
    doAssert(sortk1 != sortk2, "The sort keys should be different");
    doAssert(sortk1.hashCode() != sortk2.hashCode(), "sort key hashCode() failed");
    doAssert(sortk2.compareTo(sortk3) == 0, "The sort keys should be the same");
    doAssert(sortk1 == sortkNew, "The sort keys assignment failed");
    doAssert(sortk1.hashCode() == sortkNew.hashCode(), "sort key hashCode() failed");
    doAssert(sortkNew != sortk3, "The sort keys should be different");
    doAssert(sortk1.compareTo(sortk3) > 0, "Result should be \"Abcda\" >>> \"abcda\"");
    doAssert(sortk2.compareTo(sortk3) == 0, "Result should be \"abcda\" == \"abcda\"");
    long    cnt1, cnt2;
    byte byteArray1[] = sortk1.toByteArray();
    byte byteArray2[] = sortk2.toByteArray();
    doAssert(byteArray1 != null && byteArray2 != null, "CollationKey.toByteArray failed.");
    logln("testing sortkey ends...");
}
 
源代码19 项目: TencentKona-8   文件: MonkeyTest.java
public void TestCollationKey()
{
    String source = "-abcdefghijklmnopqrstuvwxyz#&^[email protected]";
    Random r = new Random(3);
    int s = checkValue(r.nextInt() % source.length());
    int t = checkValue(r.nextInt() % source.length());
    int slen = checkValue((r.nextInt() - source.length()) % source.length());
    int tlen = checkValue((r.nextInt() - source.length()) % source.length());
    String subs = source.substring((s > slen ? slen : s), (s >= slen ? s : slen));
    String subt = source.substring((t > tlen ? tlen : t), (t >= tlen ? t : tlen));
    myCollator.setStrength(Collator.TERTIARY);
    CollationKey CollationKey1 = myCollator.getCollationKey(subs);
    CollationKey CollationKey2 = myCollator.getCollationKey(subt);
    int result = CollationKey1.compareTo(CollationKey2);  // Tertiary
    int revResult = CollationKey2.compareTo(CollationKey1);  // Tertiary
    report(("CollationKey(" + subs + ")"), ("CollationKey(" + subt + ")"), result, revResult);
    myCollator.setStrength(Collator.SECONDARY);
    CollationKey1 = myCollator.getCollationKey(subs);
    CollationKey2 = myCollator.getCollationKey(subt);
    result = CollationKey1.compareTo(CollationKey2);  // Secondary
    revResult = CollationKey2.compareTo(CollationKey1);   // Secondary
    report(("CollationKey(" + subs + ")") , ("CollationKey(" + subt + ")"), result, revResult);
    myCollator.setStrength(Collator.PRIMARY);
    CollationKey1 = myCollator.getCollationKey(subs);
    CollationKey2 = myCollator.getCollationKey(subt);
    result = CollationKey1.compareTo(CollationKey2);  // Primary
    revResult = CollationKey2.compareTo(CollationKey1);   // Primary
    report(("CollationKey(" + subs + ")"), ("CollationKey(" + subt + ")"), result, revResult);
    String addOne = subs + "\uE000";
    CollationKey1 = myCollator.getCollationKey(subs);
    CollationKey2 = myCollator.getCollationKey(addOne);
    result = CollationKey1.compareTo(CollationKey2);
    if (result != -1)
        errln("CollationKey(" + subs + ")" + ".LT." + "CollationKey(" + addOne + ") Failed.");
    result = CollationKey2.compareTo(CollationKey1);
    if (result != 1)
        errln("CollationKey(" + addOne + ")" + ".GT." + "CollationKey(" + subs + ") Failed.");
}
 
源代码20 项目: jdk8u60   文件: ExecutableMemberDocImpl.java
/**
 * Generate a key for sorting.
 */
@Override
CollationKey generateKey() {
    String k = name() + flatSignature() + typeParametersString();
    // ',' and '&' are between '$' and 'a':  normalize to spaces.
    k = k.replace(',', ' ').replace('&', ' ');
    // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\"");
    return env.doclocale.collator.getCollationKey(k);
}
 
源代码21 项目: spliceengine   文件: SQLChar.java
/**
 * Hash code implementation for collator sensitive subclasses.
 */
int hashCodeForCollation() {
    CollationKey key = null;

    try {
        key = getCollationKey();
    } catch (StandardException se) {
        // ignore exceptions, like we do in hashCode()
        if (SanityManager.DEBUG) {
            SanityManager.THROWASSERT("Unexpected exception", se);
        }
    }

    return key == null ? 0 : key.hashCode();
}
 
源代码22 项目: openjdk-jdk8u   文件: ExecutableMemberDocImpl.java
/**
 * Generate a key for sorting.
 */
@Override
CollationKey generateKey() {
    String k = name() + flatSignature() + typeParametersString();
    // ',' and '&' are between '$' and 'a':  normalize to spaces.
    k = k.replace(',', ' ').replace('&', ' ');
    // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\"");
    return env.doclocale.collator.getCollationKey(k);
}
 
源代码23 项目: openjdk-jdk8u   文件: DocImpl.java
/**
 * return a key for sorting.
 */
CollationKey key() {
    if (collationkey == null) {
        collationkey = generateKey();
    }
    return collationkey;
}
 
源代码24 项目: openjdk-jdk8u   文件: APITest.java
public final void TestCollationKey( )
{
    logln("testing CollationKey begins...");
    Collator col = null;
    try {
        col = Collator.getInstance(Locale.ROOT);
    } catch (Exception foo) {
        errln("Error : " + foo.getMessage());
        errln("Default collation creation failed.");
    }
    if (col == null) {
        return;
    }

    String test1 = "Abcda", test2 = "abcda";
    logln("Use tertiary comparison level testing ....");
    CollationKey sortk1 = col.getCollationKey(test1);
    CollationKey sortk2 = col.getCollationKey(test2);
    doAssert(sortk1.compareTo(sortk2) > 0,
                "Result should be \"Abcda\" >>> \"abcda\"");
    CollationKey sortk3 = sortk2;
    CollationKey sortkNew = sortk1;
    doAssert(sortk1 != sortk2, "The sort keys should be different");
    doAssert(sortk1.hashCode() != sortk2.hashCode(), "sort key hashCode() failed");
    doAssert(sortk2.compareTo(sortk3) == 0, "The sort keys should be the same");
    doAssert(sortk1 == sortkNew, "The sort keys assignment failed");
    doAssert(sortk1.hashCode() == sortkNew.hashCode(), "sort key hashCode() failed");
    doAssert(sortkNew != sortk3, "The sort keys should be different");
    doAssert(sortk1.compareTo(sortk3) > 0, "Result should be \"Abcda\" >>> \"abcda\"");
    doAssert(sortk2.compareTo(sortk3) == 0, "Result should be \"abcda\" == \"abcda\"");
    long    cnt1, cnt2;
    byte byteArray1[] = sortk1.toByteArray();
    byte byteArray2[] = sortk2.toByteArray();
    doAssert(byteArray1 != null && byteArray2 != null, "CollationKey.toByteArray failed.");
    logln("testing sortkey ends...");
}
 
源代码25 项目: Android   文件: BaseListComparatorSort.java
@Override
public int compare(T lhs, T rhs) {
    String ostr1;
    String ostr2;
    String lhsName = getName(lhs);
    String rhskName = getName(rhs);

    if (TextUtils.isEmpty(lhsName)) {
        ostr1 = PinyinUtil.getFirstChar(TextUtils.isEmpty(lhsName) ? "#" : lhsName);
    } else {
        ostr1 = PinyinUtil.getFirstChar(TextUtils.isEmpty(lhsName) ? "#" : lhsName);
    }


    if (TextUtils.isEmpty(rhskName)) {
        ostr2 = PinyinUtil.getFirstChar(TextUtils.isEmpty(rhskName) ? "#" : rhskName);
    } else {
        ostr2 = PinyinUtil.getFirstChar(TextUtils.isEmpty(rhskName) ? "#" : rhskName);
    }

    CollationKey key1 = collator.getCollationKey(pinyin(ostr1.equals("") ? '#': ostr1.charAt(0)));
    CollationKey key2 = collator.getCollationKey(pinyin(ostr2.equals("") ? '#': ostr2.charAt(0)));
    // Comparison method violates its general contract
    if(key1.getSourceString().equals(key2.getSourceString())){
        return 0;
    }
    if ("#".equals(key1.getSourceString())
            || "#".equals(key2.getSourceString())) {
        if ("#".equals(key1.getSourceString())) {
            return 1;
        } else if ("#".equals(key2.getSourceString())) {
            return -1;
        }
    }
    return key1.compareTo(key2);
}
 
源代码26 项目: Android   文件: GroupMemberCompara.java
@Override
public int compare(GroupMemberEntity lhs, GroupMemberEntity rhs) {
    String string1 = TextUtils.isEmpty(lhs.getNick()) ? lhs.getUsername() : lhs.getNick();
    String string2 = TextUtils.isEmpty(rhs.getNick()) ? rhs.getUsername() : rhs.getNick();
    if (TextUtils.isEmpty(string1)) {
        string1 = "#";
    }
    if (TextUtils.isEmpty(string2)) {
        string2 = "#";
    }

    char char1 = string1.charAt(0);
    char char2 = string2.charAt(0);

    CollationKey key1 = collator.getCollationKey(PinyinUtil.chatToPinyin(char1));
    CollationKey key2 = collator.getCollationKey(PinyinUtil.chatToPinyin(char2));

    // Comparison method violates its general contract
    if (key1.getSourceString().equals(key2.getSourceString())) {
        return 0;
    }
    if ("#".equals(key1.getSourceString())
            || "#".equals(key2.getSourceString())) {
        if ("#".equals(key1.getSourceString())) {
            return 1;
        } else if ("#".equals(key2.getSourceString())) {
            return -1;
        }
    }
    return key1.compareTo(key2);
}
 
/**
 * Generate a key for sorting.
 */
@Override
CollationKey generateKey() {
    String k = name() + flatSignature() + typeParametersString();
    // ',' and '&' are between '$' and 'a':  normalize to spaces.
    k = k.replace(',', ' ').replace('&', ' ');
    // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\"");
    return env.doclocale.collator.getCollationKey(k);
}
 
源代码28 项目: openjdk-jdk8u-backup   文件: DocImpl.java
/**
 * return a key for sorting.
 */
CollationKey key() {
    if (collationkey == null) {
        collationkey = generateKey();
    }
    return collationkey;
}
 
源代码29 项目: openjdk-jdk9   文件: Utils.java
private DocCollator(Locale locale, int strength) {
    instance = Collator.getInstance(locale);
    instance.setStrength(strength);

    keys = new LinkedHashMap<String, CollationKey>(MAX_SIZE + 1, 0.75f, true) {
        private static final long serialVersionUID = 1L;
        @Override
        protected boolean removeEldestEntry(Entry<String, CollationKey> eldest) {
            return size() > MAX_SIZE;
        }
    };
}
 
源代码30 项目: openjdk-jdk9   文件: ExecutableMemberDocImpl.java
/**
 * Generate a key for sorting.
 */
@Override
CollationKey generateKey() {
    String k = name() + flatSignature() + typeParametersString();
    // ',' and '&' are between '$' and 'a':  normalize to spaces.
    k = k.replace(',', ' ').replace('&', ' ');
    // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\"");
    return env.doclocale.collator.getCollationKey(k);
}