本文整理了Java中java.lang.Character.equals()
方法的一些代码示例,展示了Character.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Character.equals()
方法的具体详情如下:
包路径:java.lang.Character
类名称:Character
方法名:equals
[英]Compares this object with the specified object and indicates if they are equal. In order to be equal, object must be an instance of Character and have the same char value as this object.
[中]将此对象与指定对象进行比较,并指示它们是否相等。为了相等,对象必须是Character的实例,并且具有与此对象相同的char值。
代码示例来源:origin: stanfordnlp/CoreNLP
/**
*/
private static boolean checkWildcardCompatibility(String txt1, String txt2) {
if (txt1.length() != txt2.length()) {
return false;
}
for (int i = 0; i < txt1.length(); i++) {
Character t1 = txt1.charAt(i);
Character t2 = txt2.charAt(i);
if (!(t1.equals('*') || t2.equals('*') || t1.equals(t2))) {
return false;
}
}
return true;
}
代码示例来源:origin: hankcs/HanLP
/**
* 是否是bad case
* @param name
* @return
*/
public static boolean isBadCase(String name)
{
Character label = JapanesePersonDictionary.get(name);
if (label == null) return false;
return label.equals(JapanesePersonDictionary.A);
}
代码示例来源:origin: stanfordnlp/CoreNLP
/**
* Right now, we say they're compatible iff one of them is all
* wildcards or they are equivalent
*
*/
@SuppressWarnings("unused")
private static boolean checkWildcardAfterCompatibility(String txt1, String txt2) {
if (txt1.length() != txt2.length()) {
return false;
}
for (int i = 0; i < txt1.length(); i++) {
Character t1 = txt1.charAt(i);
Character t2 = txt2.charAt(i);
if (!(t1.equals('*') || t2.equals('*') || t1.equals(t2))) {
return false;
}
}
return true;
}
代码示例来源:origin: json-iterator/java
protected boolean isWildcard(Object key) {
return wildcardHashCode == key.hashCode() && wildcard.equals(key);
}
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!getClass().isAssignableFrom(o.getClass())) return false;
ArchiveStatus that = (ArchiveStatus) o;
if (archived != null ? !archived.equals(that.archived) : that.archived != null) return false;
return true;
}
代码示例来源:origin: apache/incubator-druid
@Override
public boolean equals(Object o)
{
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
LikeDimFilter that = (LikeDimFilter) o;
if (dimension != null ? !dimension.equals(that.dimension) : that.dimension != null) {
return false;
}
if (pattern != null ? !pattern.equals(that.pattern) : that.pattern != null) {
return false;
}
if (escapeChar != null ? !escapeChar.equals(that.escapeChar) : that.escapeChar != null) {
return false;
}
return extractionFn != null ? extractionFn.equals(that.extractionFn) : that.extractionFn == null;
}
代码示例来源:origin: mabe02/lanterna
@SuppressWarnings("SimplifiableIfStatement")
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final KeyStroke other = (KeyStroke) obj;
if (this.keyType != other.keyType) {
return false;
}
if (this.character != other.character && (this.character == null || !this.character.equals(other.character))) {
return false;
}
return this.ctrlDown == other.ctrlDown &&
this.altDown == other.altDown &&
this.shiftDown == other.shiftDown;
}
代码示例来源:origin: ehcache/ehcache3
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Character object, ByteBuffer binary) {
return object.equals(read(binary));
}
}
代码示例来源:origin: google/agera
@Override
public boolean apply(@NonNull final Character value) {
return value.equals(character);
}
}
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
if (other.modifiable != null)
return false;
} else if (!modifiable.equals(other.modifiable))
return false;
return true;
代码示例来源:origin: org.jsoup/jsoup
Character c = consume();
if (last == 0 || last != ESC) {
if (c.equals('\'') && c != open && !inDoubleQuote)
inSingleQuote = !inSingleQuote;
else if (c.equals('"') && c != open && !inSingleQuote)
inDoubleQuote = !inDoubleQuote;
if (inSingleQuote || inDoubleQuote)
continue;
if (c.equals(open)) {
depth++;
if (start == -1)
start = pos;
else if (c.equals(close))
depth--;
代码示例来源:origin: apache/geode
Character character = ((Character) value);
value = character.equals(Character.valueOf((char) 0)) ? null : character.toString();
} else if (value instanceof Date) {
Date jdkDate = (Date) value;
代码示例来源:origin: eirslett/frontend-maven-plugin
if (quote == null) {
quote = currentQuote;
} else if (quote.equals(currentQuote)){
quote = null;
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
if (((Character) directValue).equals('N')) {
attachNullClause = true;
代码示例来源:origin: libgdx/libgdx
if (CharacterField == null) {
if (other.CharacterField != null) return false;
} else if (!CharacterField.equals(other.CharacterField)) return false;
if (DoubleField == null) {
if (other.DoubleField != null) return false;
代码示例来源:origin: apache/incubator-gobblin
private void checkEmptyPath(UrlTrie trie, String path, int pathChildrenCount) {
for (int i = 1; i < path.length(); ++i) {
UrlTrieNode node = trie.getChild(path.substring(0, i));
Assert.assertTrue(node.getValue().equals(path.charAt(i - 1)));
Assert.assertEquals(pathChildrenCount, node.getSize());
Assert.assertFalse(node.isExist());
}
}
}
代码示例来源:origin: apache/incubator-gobblin
@Test
public void testTrieRoot3() {
UrlTrie trie = new UrlTrie("www.linkedin.com/", new ArrayList<String>());
UrlTrieNode root = trie.getRoot();
Assert.assertTrue(root.getValue().equals('/'));
Assert.assertEquals(0, root.getSize());
//Assert.assertTrue(root.getParent() == null);
}
代码示例来源:origin: apache/incubator-gobblin
@Test
public void testDuplicate() {
UrlTrie trie = new UrlTrie("https://www.linkedin.com/",
Arrays.asList("https://www.linkedin.com/", "https://www.linkedin.com/", "https://www.linkedin.com/in/"));
UrlTrieNode root = trie.getRoot();
Assert.assertTrue(root.getValue().equals('/'));
Assert.assertEquals(1, root.children.size());
Assert.assertTrue(root.isExist());
Assert.assertEquals(3, root.getSize());
// Path1
String path1 = "in/";
checkEmptyPath(trie, path1, 1);
UrlTrieNode inNode = trie.getChild("in/");
Assert.assertTrue(inNode.getValue().equals('/'));
Assert.assertEquals(1, inNode.getSize());
Assert.assertTrue(inNode.isExist());
}
代码示例来源:origin: apache/incubator-gobblin
@Test
public void testTrieVertical() {
UrlTrie trie = new UrlTrie("https://www.linkedin.com/",
Arrays.asList("https://www.linkedin.com/", "https://www.linkedin.com/in/",
"https://www.linkedin.com/in/chenguo"));
UrlTrieNode root = trie.getRoot();
Assert.assertTrue(root.getValue().equals('/'));
Assert.assertEquals(1, root.children.size());
Assert.assertTrue(root.isExist());
Assert.assertEquals(3, root.getSize());
// Path1
String path1 = "in/";
checkEmptyPath(trie, path1, 2);
UrlTrieNode inNode = trie.getChild("in/");
Assert.assertTrue(inNode.getValue().equals('/'));
Assert.assertEquals(2, inNode.getSize());
Assert.assertTrue(inNode.isExist());
UrlTrieNode chenguo = inNode.getChild("chenguo");
Assert.assertEquals(root.getChild("in/chenguo"), chenguo);
Assert.assertTrue(chenguo.getValue().equals('o'));
Assert.assertEquals(1, chenguo.getSize());
Assert.assertTrue(chenguo.isExist());
}
代码示例来源:origin: apache/incubator-gobblin
@Test
public void testTrieFlat() {
UrlTrie trie = new UrlTrie("https://www.linkedin.com/",
Arrays.asList("https://www.linkedin.com/jobs/", "https://www.linkedin.com/in/"));
UrlTrieNode root = trie.getRoot();
Assert.assertTrue(root.getValue().equals('/'));
Assert.assertEquals(2, root.children.size());
Assert.assertFalse(root.isExist());
Assert.assertEquals(2, root.getSize());
// Path1
String path1 = "jobs/";
checkEmptyPath(trie, path1, 1);
UrlTrieNode jobNode = trie.getChild("jobs/");
Assert.assertTrue(jobNode.getValue().equals('/'));
Assert.assertEquals(1, jobNode.getSize());
Assert.assertTrue(jobNode.isExist());
// Path2
String path2 = "in/";
checkEmptyPath(trie, path2, 1);
UrlTrieNode inNode = trie.getChild("in/");
Assert.assertTrue(inNode.getValue().equals('/'));
Assert.assertEquals(1, inNode.getSize());
Assert.assertTrue(inNode.isExist());
}
内容来源于网络,如有侵权,请联系作者删除!