Java Code Examples for org.eclipse.collections.impl.map.mutable.primitive.IntObjectHashMap#forEachKeyValue()

The following examples show how to use org.eclipse.collections.impl.map.mutable.primitive.IntObjectHashMap#forEachKeyValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SerializationUtils.java    From exchange-core with Apache License 2.0 5 votes vote down vote up
public static <T extends WriteBytesMarshallable> void marshallIntHashMap(final IntObjectHashMap<T> hashMap, final BytesOut bytes) {
    bytes.writeInt(hashMap.size());
    hashMap.forEachKeyValue((k, v) -> {
        bytes.writeInt(k);
        v.writeMarshallable(bytes);
    });
}
 
Example 2
Source File: SerializationUtils.java    From exchange-core with Apache License 2.0 5 votes vote down vote up
public static <T> void marshallIntHashMap(final IntObjectHashMap<T> hashMap, final BytesOut bytes, final Consumer<T> elementMarshaller) {
    bytes.writeInt(hashMap.size());
    hashMap.forEachKeyValue((k, v) -> {
        bytes.writeInt(k);
        elementMarshaller.accept(v);
    });
}
 
Example 3
Source File: HashingUtils.java    From exchange-core with Apache License 2.0 4 votes vote down vote up
public static <T extends StateHash> int stateHash(final IntObjectHashMap<T> hashMap) {

        final MutableLong mutableLong = new MutableLong();
        hashMap.forEachKeyValue((k, v) -> mutableLong.addAndGet(Objects.hash(k, v.stateHash())));
        return Long.hashCode(mutableLong.value);
    }