本文整理了Java中java.text.Collator.equals()
方法的一些代码示例,展示了Collator.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Collator.equals()
方法的具体详情如下:
包路径:java.text.Collator
类名称:Collator
方法名:equals
[英]Compares this collator with the specified object and indicates if they are equal.
[中]将此折叠器与指定对象进行比较,并指示它们是否相等。
代码示例来源:origin: osmandapp/Osmand
@Override
public boolean equals(Object obj) {
return instance.equals(obj);
}
代码示例来源:origin: osmandapp/Osmand
@Override
public boolean equals(String source, String target) {
return instance.equals(source, target);
}
代码示例来源:origin: robovm/robovm
/**
* Compares the specified object with this {@code RuleBasedCollator} and
* indicates if they are equal. In order to be equal, {@code object} must be
* an instance of {@code Collator} with the same collation rules and the
* same attributes.
*
* @param obj
* the object to compare with this object.
* @return {@code true} if the specified object is equal to this
* {@code RuleBasedCollator}; {@code false} otherwise.
* @see #hashCode
*/
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Collator)) {
return false;
}
return super.equals(obj);
}
}
代码示例来源:origin: jdbi/jdbi
@Benchmark
public boolean collatorEqualsOther() {
return collator.equals(original, other);
}
代码示例来源:origin: jdbi/jdbi
@Benchmark
public boolean collatorEqualsRandomCase() {
return collator.equals(original, randomizedCase);
}
代码示例来源:origin: jdbi/jdbi
@Benchmark
public boolean collatorEqualsCopy() {
return collator.equals(original, copy);
}
代码示例来源:origin: ru.sbtqa/monte-media
@Override
public boolean equals(Object o) {
if (o instanceof OSXCollator) {
OSXCollator that = (OSXCollator) o;
return this.collator.equals(that.collator);
} else {
return false;
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean equals(Object o) {
if(o instanceof NaturalOrderCollator) {
NaturalOrderCollator that = (NaturalOrderCollator) o;
return this.collator.equals(that.collator);
}
else {
return false;
}
}
代码示例来源:origin: at.bestsolution.eclipse/com.ibm.icu.base
public boolean equals(Object rhs) {
try {
return collator.equals(((Collator)rhs).collator);
}
catch (Exception e) {
return false;
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.ibm.icu.base
public boolean equals(Object rhs) {
try {
return collator.equals(((Collator)rhs).collator);
}
catch (Exception e) {
return false;
}
}
代码示例来源:origin: mucommander/mucommander
/**
* This method is a locale-aware version of <code>java.lang.String#equals(Object)</code>. It returns
* <code>true</code> if the two given <code>String</code> are equal in the specified <code>Locale</code>.
*
* <p>This method is useful for testing text expressed in a language where two strings with an identical
* written representation can have a different <code>String</code> representation according to
* <code>java.lang.String#equals(Object)</code>. Japanese is such a language for instance.
* This method uses the <code>java.text.Collator</code> class under the hood.
*
* @param s1 a String to compare
* @param s2 a String to compare
* @param locale the Locale to consider for testing the String
* @return true if the two given String are equal in the specified Locale
*/
public static boolean equals(String s1, String s2, Locale locale) {
return Collator.getInstance(locale).equals(s1, s2);
}
代码示例来源:origin: com.salesforce.i18n/i18n-util
@Override
public boolean equals(Object that) {
if (this == that) return true;
if (that == null) return false;
if (getClass() != that.getClass()) return false;
ThaiPatchedCollator other = (ThaiPatchedCollator) that;
return (this.originalCollator.equals(other.originalCollator));
}
代码示例来源:origin: stackoverflow.com
public static void main( String[] args ) {
String withVowels = "בַּיִת";
String withoutVowels = "בית";
String withVowelsTwo = "הַבַּיְתָה";
String withoutVowelsTwo = "הביתה";
System.out.println( "These two strings are " + (withVowels.equals( withoutVowels ) ? "" : "not ") + "equal" );
System.out.println( "The second two strings are " + (withVowelsTwo.equals( withoutVowelsTwo ) ? "" : "not ") + "equal" );
Collator collator = Collator.getInstance( new Locale( "he" ) );
collator.setStrength( Collator.PRIMARY );
System.out.println( collator.equals( withVowels, withoutVowels ) );
System.out.println( collator.equals( withVowelsTwo, withoutVowelsTwo ) );
}
代码示例来源:origin: stackoverflow.com
private int indexOf(String[] original, String search) {
Collator collator = Collator.getInstance();
collator.setStrength(Collator.SECONDARY);
for(int i = 0;i<original.length;++i) {
if(collator.equals(search, original[i]))
return i;
}
return -1;
}
代码示例来源:origin: stackoverflow.com
private int indexOf(String original, String search) {
Collator collator = Collator.getInstance();
collator.setStrength(Collator.PRIMARY);
for (int i = 0; i <= original.length() - search.length(); i++) {
if (collator.equals(search, original.substring(i, i + search.length()))) {
return i;
}
}
return -1;
}
代码示例来源:origin: stackoverflow.com
Collator usCollator = Collator.getInstance();
usCollator.setStrength(Collator.TERTIARY);
System.out.println(usCollator.equals(st, st2));
代码示例来源:origin: com.github.marschall/memoryfilesystem
private boolean samePathAs(AbstractPath other) {
if (!(other instanceof NamedRoot)) {
return false;
}
NamedRoot otherRoot = (NamedRoot) other;
//TODO safe collator key
Collator collator = this.getMemoryFileSystem().getCollator();
return collator.equals(Character.toString(this.letter), Character.toString(otherRoot.letter));
}
代码示例来源:origin: stackoverflow.com
Collator c = Collator.getInstance(Locale.US);
c.setStrength(Collator.IDENTICAL);
c.setDecomposition(Collator.FULL_DECOMPOSITION);
boolen a3 = c.equals(a1, a2); // should be true now
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
/** Returns true iff <code>o</code> is equal to this. */
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof RangeQuery)) return false;
final RangeQuery other = (RangeQuery) o;
if (this.getBoost() != other.getBoost()) return false;
if (this.inclusive != other.inclusive) return false;
if (this.collator != null && ! this.collator.equals(other.collator))
return false;
// one of lowerTerm and upperTerm can be null
if (this.lowerTerm != null ? !this.lowerTerm.equals(other.lowerTerm) : other.lowerTerm != null) return false;
if (this.upperTerm != null ? !this.upperTerm.equals(other.upperTerm) : other.upperTerm != null) return false;
return true;
}
代码示例来源:origin: org.apache.lucene/lucene-core-jfrog
/** Returns true iff <code>o</code> is equal to this. */
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof RangeQuery)) return false;
final RangeQuery other = (RangeQuery) o;
if (this.getBoost() != other.getBoost()) return false;
if (this.inclusive != other.inclusive) return false;
if (this.collator != null && ! this.collator.equals(other.collator))
return false;
// one of lowerTerm and upperTerm can be null
if (this.lowerTerm != null ? !this.lowerTerm.equals(other.lowerTerm) : other.lowerTerm != null) return false;
if (this.upperTerm != null ? !this.upperTerm.equals(other.upperTerm) : other.upperTerm != null) return false;
return true;
}
内容来源于网络,如有侵权,请联系作者删除!