|
iText 7 7.1.8 API
|
This class is a convenience method to sequentially calculate hash code of the object based on the field values. More...
Public Member Functions |
|
| sealed override int | GetHashCode () |
| Returns accumulated hashCode More... |
|
| HashCode | Append (int value) |
| Appends value's hashCode to the current hashCode. More... |
|
| HashCode | Append (long value) |
| Appends value's hashCode to the current hashCode. More... |
|
| HashCode | Append (float value) |
| Appends value's hashCode to the current hashCode. More... |
|
| HashCode | Append (double value) |
| Appends value's hashCode to the current hashCode. More... |
|
| HashCode | Append (bool value) |
| Appends value's hashCode to the current hashCode. More... |
|
| HashCode | Append (Object value) |
| Appends value's hashCode to the current hashCode. More... |
|
Static Public Member Functions |
|
| static int | Combine (int hashCode, bool value) |
| Combines hashCode of previous elements sequence and value's hashCode. More... |
|
| static int | Combine (int hashCode, long value) |
| Combines hashCode of previous elements sequence and value's hashCode. More... |
|
| static int | Combine (int hashCode, float value) |
| Combines hashCode of previous elements sequence and value's hashCode. More... |
|
| static int | Combine (int hashCode, double value) |
| Combines hashCode of previous elements sequence and value's hashCode. More... |
|
| static int | Combine (int hashCode, Object value) |
| Combines hashCode of previous elements sequence and value's hashCode. More... |
|
| static int | Combine (int hashCode, int value) |
| Combines hashCode of previous elements sequence and value's hashCode. More... |
|
Static Public Attributes |
|
| const int | EMPTY_HASH_CODE = 1 |
| The hashCode value before any data is appended, equals to 1. More... |
|
This class is a convenience method to sequentially calculate hash code of the object based on the field values.
This class is a convenience method to sequentially calculate hash code of the object based on the field values. The result depends on the order of elements appended. The exact formula is the same as for System.Collections.IList
Suppose we have class:
class Thing {
long id;
String name;
float weight;
}
The hash code calculation can be expressed in 2 forms.
For maximum performance:
public int hashCode() {
int hashCode = HashCode.EMPTY_HASH_CODE;
hashCode = HashCode.combine(hashCode, id);
hashCode = HashCode.combine(hashCode, name);
hashCode = HashCode.combine(hashCode, weight);
return hashCode;
}
For convenience:
public int hashCode() {
return new HashCode().append(id).append(name).append(weight).hashCode();
}
|
inline |
Appends value's hashCode to the current hashCode.
| value | new element |
|
inline |
Appends value's hashCode to the current hashCode.
| value | new element |
|
inline |
Appends value's hashCode to the current hashCode.
| value | new element |
|
inline |
Appends value's hashCode to the current hashCode.
| value | new element |
|
inline |
Appends value's hashCode to the current hashCode.
| value | new element |
|
inline |
Appends value's hashCode to the current hashCode.
| value | new element |
|
inlinestatic |
Combines hashCode of previous elements sequence and value's hashCode.
| hashCode | previous hashCode value |
| value | new element |
|
inlinestatic |
Combines hashCode of previous elements sequence and value's hashCode.
| hashCode | previous hashCode value |
| value | new element |
|
inlinestatic |
Combines hashCode of previous elements sequence and value's hashCode.
| hashCode | previous hashCode value |
| value | new element |
|
inlinestatic |
Combines hashCode of previous elements sequence and value's hashCode.
| hashCode | previous hashCode value |
| value | new element |
|
inlinestatic |
Combines hashCode of previous elements sequence and value's hashCode.
| hashCode | previous hashCode value |
| value | new element |
|
inlinestatic |
Combines hashCode of previous elements sequence and value's hashCode.
| hashCode | previous hashCode value |
| value | new element |
|
inline |
Returns accumulated hashCode
|
static |
The hashCode value before any data is appended, equals to 1.