dschneider-pivotal commented on a change in pull request #6768:
URL: https://github.com/apache/geode/pull/6768#discussion_r697784982



##########
File path: 
geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/collections/Bytes2ObjectOpenHashMap.java
##########
@@ -0,0 +1,1287 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.collections;
+
+import static it.unimi.dsi.fastutil.HashCommon.arraySize;
+import static it.unimi.dsi.fastutil.HashCommon.maxFill;
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+
+import it.unimi.dsi.fastutil.Hash;
+import it.unimi.dsi.fastutil.HashCommon;
+import it.unimi.dsi.fastutil.Pair;
+import it.unimi.dsi.fastutil.bytes.ByteArrays;
+import it.unimi.dsi.fastutil.objects.AbstractObject2ObjectMap;
+import it.unimi.dsi.fastutil.objects.AbstractObjectCollection;
+import it.unimi.dsi.fastutil.objects.AbstractObjectSet;
+import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
+import it.unimi.dsi.fastutil.objects.ObjectArrayList;
+import it.unimi.dsi.fastutil.objects.ObjectCollection;
+import it.unimi.dsi.fastutil.objects.ObjectIterator;
+import it.unimi.dsi.fastutil.objects.ObjectSet;
+import it.unimi.dsi.fastutil.objects.ObjectSpliterator;
+import it.unimi.dsi.fastutil.objects.ObjectSpliterators;
+
+/**
+ * This class was derived from Object2ObjectOpenCustomHashMap.
+ * The differences are:
+ * 1. the keys are always a byte[] so no need for "strategy" field
+ * 2. the load factor is always the default so no need for the "f" field.
+ * 3. no support for the "null" key so no need for the boolean field that 
signifies a null key
+ * exists
+ * 4. the fields that cache a singleton instance for entrySet, keySet, and 
values
+ * no longer exist.
+ */
+public class Bytes2ObjectOpenHashMap<V> extends 
AbstractObject2ObjectMap<byte[], V>
+    implements java.io.Serializable, Cloneable, Hash {
+  private static final Strategy<byte[]> strategy = ByteArrays.HASH_STRATEGY;
+  private static final long serialVersionUID = 0L;
+
+  /** The array of keys. */
+  protected transient byte[][] key;
+  /** The array of values. */
+  protected transient V[] value;
+  /** The mask for wrapping a position counter. */
+  protected transient int mask;
+  /** The current table size. */
+  protected transient int n;

Review comment:
       keep in mind that this class (as described in the class comment) was 
derived from: Object2ObjectOpenCustomHashMap
   So all these names and implementations came from it. My goal was just to get 
rid of some of its fields to save on memory overhead. I didn't want to redo the 
entire class. I did clean up some warnings and made some changes so it conforms 
to our coding standards but I didn't plan on doing a complete rewrite. And I 
don't understand all of the code or why it was written a certain way. We were 
using this code before (when we extended Object2ObjectOpenCustomHashMap) so it 
does seem to function correctly.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to