@Override
    public List<Feature> map(String tag, List<Feature> features) {

        List<Feature> hashedFeatures = new ArrayList<>();
        
        for (Feature feature : features) {
            int hash = MurmurHash3.murmurhash3_x86_32(feature.getName(), 0, feature.getName().length(), hashSeed);
            hash = hash >>> 1;
            int code = hash % dimension;

            double value;
            if (preserveValue) {
                value = feature.getValue();
            } else {
                int bit = MurmurHash3.murmurhash3_x86_32(feature.getName(), 0, feature.getName().length(), valueHashSeed) & 1;
                value = bit == 1 ? 1 : -1;
            }

            Feature newFeature = new Feature(tag + "-hash="+code, value);
            hashedFeatures.add(newFeature);
        }

        return hashedFeatures;
    }
@Test
    public void negativeValuesTest() {
        List<Feature> input = new ArrayList<>();
        Feature posValue = new Feature("Testing", 2.0);
        input.add(posValue);
        Feature negValue = new Feature("Test",2.0);
        input.add(negValue);

        FeatureHasher preserving = new FeatureHasher(10, true);
        FeatureHasher notPreserving = new FeatureHasher(10, false);

        List<Feature> preservingOutput = preserving.map("test", input);
        List<Feature> notPreservingOutput = notPreserving.map("test", input);

        assertEquals(2.0, preservingOutput.get(0).getValue());
        assertEquals(2.0, preservingOutput.get(1).getValue());

        assertEquals(1.0, notPreservingOutput.get(0).getValue());
        assertEquals(-1.0, notPreservingOutput.get(1).getValue());
    }