本文整理了Java中org.assertj.core.util.Objects
类的一些代码示例,展示了Objects
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Objects
类的具体详情如下:
包路径:org.assertj.core.util.Objects
类名称:Objects
[英]Utility methods related to objects.
[中]与对象相关的实用方法。
代码示例来源:origin: org.assertj/assertj-core
/**
* Returns <code>true</code> if given item is in given array, <code>false</code> otherwise.
*
* @param item the object to look for in arrayOfValues
* @param arrayOfValues the array of values
* @return <code>true</code> if given item is in given array, <code>false</code> otherwise.
*/
private static boolean isItemInArray(Object item, Object[] arrayOfValues) {
for (Object value : arrayOfValues)
if (areEqual(value, item)) return true;
return false;
}
代码示例来源:origin: org.assertj/assertj-core
@Override
public int hashCode() {
int result = 1;
result = HASH_CODE_PRIME * result + hashCodeFor(actual);
result = HASH_CODE_PRIME * result + hashCodeFor(expected);
return result;
}
代码示例来源:origin: org.assertj/assertj-core
/**
* Returns {@code true} if the given objects are equal or if both objects are {@code null}.
*
* @param o1 one of the objects to compare.
* @param o2 one of the objects to compare.
* @return {@code true} if the given objects are equal or if both objects are {@code null}.
*/
public static boolean areEqual(Object o1, Object o2) {
if (o1 == null) {
return o2 == null;
}
if (o1.equals(o2)) {
return true;
}
return areEqualArrays(o1, o2);
}
代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils
private String typeNames(Class<?>... types) {
return Arrays.toString(namesOf(types));
}
代码示例来源:origin: org.assertj/assertj-core
/**
* Returns true if actual and other are equal based on {@link Objects#areEqual(Object, Object)}, false otherwise.
*
* @param actual the object to compare to other
* @param other the object to compare to actual
* @return true if actual and other are equal based on {@link Objects#areEqual(Object, Object)}, false otherwise.
*/
@Override
public boolean areEqual(Object actual, Object other) {
return Objects.areEqual(actual, other);
}
代码示例来源:origin: org.assertj/assertj-core
@Override
public int hashCode() {
return HASH_CODE_PRIME * hashCodeFor(description);
}
}
代码示例来源:origin: joel-costigliola/assertj-core
/**
* Returns {@code true} if the given objects are equal or if both objects are {@code null}.
*
* @param o1 one of the objects to compare.
* @param o2 one of the objects to compare.
* @return {@code true} if the given objects are equal or if both objects are {@code null}.
*/
public static boolean areEqual(Object o1, Object o2) {
if (o1 == null) {
return o2 == null;
}
if (o1.equals(o2)) {
return true;
}
return areEqualArrays(o1, o2);
}
代码示例来源:origin: org.assertj/assertj-core
protected boolean areEqual(final NUMBER value, final NUMBER other) {
return Objects.areEqual(value, other);
}
代码示例来源:origin: org.assertj/assertj-core
@Override
public int hashCode() {
int result = 1;
result = HASH_CODE_PRIME * result + hashCodeFor(value);
return result;
}
代码示例来源:origin: org.assertj/assertj-core
@Override
public int compare(Object actual, Object other) {
return areEqual(actual, other) ? 0 : NOT_EQUAL;
}
代码示例来源:origin: org.assertj/assertj-core
@Override
public int hashCode() {
return HASH_CODE_PRIME + hashCodeFor(value) + hashCodeFor(args);
}
代码示例来源:origin: org.assertj/assertj-core
boolean filter(Object propertyValueOfCurrentElement) {
return !areEqual(propertyValueOfCurrentElement, filterParameter);
}
代码示例来源:origin: joel-costigliola/assertj-core
@Override
public int hashCode() {
return HASH_CODE_PRIME * hashCodeFor(description);
}
}
代码示例来源:origin: joel-costigliola/assertj-core
/**
* Returns true if actual and other are equal based on {@link Objects#areEqual(Object, Object)}, false otherwise.
*
* @param actual the object to compare to other
* @param other the object to compare to actual
* @return true if actual and other are equal based on {@link Objects#areEqual(Object, Object)}, false otherwise.
*/
@Override
public boolean areEqual(Object actual, Object other) {
return Objects.areEqual(actual, other);
}
代码示例来源:origin: joel-costigliola/assertj-core
@Override
public int hashCode() {
int result = 1;
result = HASH_CODE_PRIME * result + hashCodeFor(actual);
result = HASH_CODE_PRIME * result + hashCodeFor(expected);
return result;
}
代码示例来源:origin: joel-costigliola/assertj-core
/**
* Returns <code>true</code> if given item is in given array, <code>false</code> otherwise.
*
* @param item the object to look for in arrayOfValues
* @param arrayOfValues the array of values
* @return <code>true</code> if given item is in given array, <code>false</code> otherwise.
*/
private static boolean isItemInArray(Object item, Object[] arrayOfValues) {
for (Object value : arrayOfValues)
if (areEqual(value, item)) return true;
return false;
}
代码示例来源:origin: joel-costigliola/assertj-core
@Override
public int hashCode() {
int result = 1;
result = HASH_CODE_PRIME * result + hashCodeFor(value);
return result;
}
代码示例来源:origin: joel-costigliola/assertj-core
@Override
public int compare(Object actual, Object other) {
return areEqual(actual, other) ? 0 : NOT_EQUAL;
}
代码示例来源:origin: joel-costigliola/assertj-core
@Override
public int hashCode() {
return HASH_CODE_PRIME + hashCodeFor(value) + hashCodeFor(args);
}
代码示例来源:origin: org.assertj/assertj-core
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
TextDescription other = (TextDescription) obj;
return areEqual(value, other.value) && areEqual(args, other.args);
}
}
内容来源于网络,如有侵权,请联系作者删除!