All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.carrotsearch.hppcrt.strategies.FloatStandardHash Maven / Gradle / Ivy

Go to download

High Performance Primitive Collections Realtime (fork of HPPC of Carrotsearch) Fundamental data structures (maps, sets, lists, stacks, queues, heaps, sorts) generated for combinations of object and primitive types to conserve JVM memory and speed up execution. The Realtime fork intend of extending collections while tweaking and optimizations to remove any dynamic allocations at runtime, and low variance execution times.

There is a newer version: 0.7.5
Show newest version
package com.carrotsearch.hppcrt.strategies;

import com.carrotsearch.hppcrt.Internals;
import com.carrotsearch.hppcrt.Intrinsics;

  
  
/**
 * Standard  {@link FloatHashingStrategy} for floats, providing the same behavior as equals()/ hashCode()
 * gives for objects.
 */
 @javax.annotation.Generated(date = "2015-02-27T19:21:18+0100", value = "HPPC-RT generated from: FloatStandardHash.java") 
public final class FloatStandardHash implements FloatHashingStrategy
{

    public FloatStandardHash() {
        // nothing
    }

    @Override
    public int computeHashCode(final float object) {

        return Internals.rehash(object);
    }

    @Override
    public boolean equals(final float o1, final float o2) {

        return (Float.floatToIntBits(o1) == Float.floatToIntBits(o2));
    }

    @Override
    public boolean equals(final Object o) {

        if (o instanceof FloatStandardHash) {

            return true;
        }

        return false;
    }

    @Override
    public int hashCode() {

        return System.identityHashCode(FloatStandardHash.class);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy