本文整理了Java中java.lang.Character.hashCode()
方法的一些代码示例,展示了Character.hashCode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Character.hashCode()
方法的具体详情如下:
包路径:java.lang.Character
类名称:Character
方法名:hashCode
[英]Returns a hash code for this Character; equal to the result of invoking charValue().
[中]返回此字符的哈希代码;等于调用charValue()的结果。
代码示例来源:origin: neo4j/neo4j
/**
* Calculate hash code of a char value
* @param value the value to compute hash code for
* @return the hash code of the given value
*/
public static int hashCode( char value )
{
return Character.hashCode( value );
}
代码示例来源:origin: vavr-io/vavr
/**
* Returns the hashcode of the given value.
*
* @param value the value to hash
* @return the hashcode
* @see Character#hashCode()
*/
static int hash(char value) {
return Character.hashCode(value);
}
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
@Override
public int hashCode() {
return archived != null ? archived.hashCode() : 0;
}
}
代码示例来源:origin: google/guava
@Override
public int hashCode() {
return i.hashCode();
}
代码示例来源:origin: apache/incubator-druid
@Override
public int hashCode()
{
int result = dimension != null ? dimension.hashCode() : 0;
result = 31 * result + (pattern != null ? pattern.hashCode() : 0);
result = 31 * result + (escapeChar != null ? escapeChar.hashCode() : 0);
result = 31 * result + (extractionFn != null ? extractionFn.hashCode() : 0);
return result;
}
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((codeType == null) ? 0 : codeType.hashCode());
result = prime * result
+ ((description == null) ? 0 : description.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result
+ ((modifiable == null) ? 0 : modifiable.hashCode());
return result;
}
代码示例来源:origin: mabe02/lanterna
@Override
public int hashCode() {
int hash = 3;
hash = 41 * hash + (this.keyType != null ? this.keyType.hashCode() : 0);
hash = 41 * hash + (this.character != null ? this.character.hashCode() : 0);
hash = 41 * hash + (this.ctrlDown ? 1 : 0);
hash = 41 * hash + (this.altDown ? 1 : 0);
hash = 41 * hash + (this.shiftDown ? 1 : 0);
return hash;
}
代码示例来源:origin: apache/mahout
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Character.valueOf(x).hashCode();
return result;
}
代码示例来源:origin: google/guava
public void testHashCode() {
for (char value : VALUES) {
assertEquals(((Character) value).hashCode(), Chars.hashCode(value));
}
}
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* Checks if the string got by {@link RandomStringUtils#random(int)}
* can be converted to UTF-8 and back without loss.
*
* @see <a href="http://issues.apache.org/jira/browse/LANG-100">LANG-100</a>
*/
@Test
public void testLang100() {
final int size = 5000;
final Charset charset = Charset.forName("UTF-8");
final String orig = RandomStringUtils.random(size);
final byte[] bytes = orig.getBytes(charset);
final String copy = new String(bytes, charset);
// for a verbose compare:
for (int i=0; i < orig.length() && i < copy.length(); i++) {
final char o = orig.charAt(i);
final char c = copy.charAt(i);
assertEquals("differs at " + i + "(" + Integer.toHexString(new Character(o).hashCode()) + "," +
Integer.toHexString(new Character(c).hashCode()) + ")", o, c);
}
// compare length also
assertEquals(orig.length(), copy.length());
// just to be complete
assertEquals(orig, copy);
}
代码示例来源:origin: apache/geode
@Test
public void testHashCode() {
assertEquals(0, ObjectUtils.hashCode(null));
assertEquals(Character.valueOf('c').hashCode(), ObjectUtils.hashCode('c'));
assertEquals(Boolean.TRUE.hashCode(), ObjectUtils.hashCode(true));
assertEquals(Double.valueOf(Math.PI).hashCode(), ObjectUtils.hashCode(Math.PI));
assertEquals(Integer.valueOf(0).hashCode(), ObjectUtils.hashCode(0));
assertEquals("test".hashCode(), ObjectUtils.hashCode("test"));
}
代码示例来源:origin: org.apache.commons/commons-csv
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + delimiter;
result = prime * result + ((quoteMode == null) ? 0 : quoteMode.hashCode());
result = prime * result + ((quoteCharacter == null) ? 0 : quoteCharacter.hashCode());
result = prime * result + ((commentMarker == null) ? 0 : commentMarker.hashCode());
result = prime * result + ((escapeCharacter == null) ? 0 : escapeCharacter.hashCode());
result = prime * result + ((nullString == null) ? 0 : nullString.hashCode());
result = prime * result + (ignoreSurroundingSpaces ? 1231 : 1237);
result = prime * result + (ignoreHeaderCase ? 1231 : 1237);
result = prime * result + (ignoreEmptyLines ? 1231 : 1237);
result = prime * result + (skipHeaderRecord ? 1231 : 1237);
result = prime * result + ((recordSeparator == null) ? 0 : recordSeparator.hashCode());
result = prime * result + Arrays.hashCode(header);
return result;
}
代码示例来源:origin: jamesagnew/hapi-fhir
sb.append("&#x"+Integer.toHexString(new Character(ch).hashCode()).toUpperCase()+";");
else if (isNoLines) {
if (ch == '\r')
代码示例来源:origin: aol/cyclops
@Test
public void sorted2() {
assertThat(empty.sorted(i->i.hashCode()),equalTo(empty));
assertThat(str.sorted(i->i.hashCode()).toString(),equalTo(" dehllloorw"));
}
代码示例来源:origin: org.tinygroup/org.tinygroup.tinyseg
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((character == null) ? 0 : character.hashCode());
return result;
}
代码示例来源:origin: LearnLib/automatalib
@Override
public final int hashCode() {
int result = 1;
result = 31 * result + Character.hashCode(min);
result = 31 * result + Character.hashCode(max);
return result;
}
}
代码示例来源:origin: biojava/biojava
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((chainName == null) ? 0 : chainName.hashCode());
result = prime * result + ((insCode == null) ? 0 : insCode.hashCode());
result = prime * result + ((seqNum == null) ? 0 : seqNum.hashCode());
return result;
}
代码示例来源:origin: io.druid/druid-processing
@Override
public int hashCode()
{
int result = dimension != null ? dimension.hashCode() : 0;
result = 31 * result + (pattern != null ? pattern.hashCode() : 0);
result = 31 * result + (escapeChar != null ? escapeChar.hashCode() : 0);
result = 31 * result + (extractionFn != null ? extractionFn.hashCode() : 0);
return result;
}
代码示例来源:origin: org.apache.druid/druid-processing
@Override
public int hashCode()
{
int result = dimension != null ? dimension.hashCode() : 0;
result = 31 * result + (pattern != null ? pattern.hashCode() : 0);
result = 31 * result + (escapeChar != null ? escapeChar.hashCode() : 0);
result = 31 * result + (extractionFn != null ? extractionFn.hashCode() : 0);
return result;
}
代码示例来源:origin: MrHadiSatrio/Optional
/**
* Returns the hash code value of the present value, if any, or 0 (zero) if
* no value is present.
*
* @return hash code value of the present value or 0 if no value is present
*/
@Override
public int hashCode() {
return isPresent() ? new Character(value).hashCode() : 0;
}
内容来源于网络,如有侵权,请联系作者删除!