Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primitive collection API updates #91

Merged
merged 22 commits into from
Apr 27, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f66d165
[test] Move configuration test cases below top-level package
apeteri Apr 22, 2016
2c5f85f
[test] Add test cases for primitive sets
apeteri Apr 25, 2016
9bd889e
[collect] Update primitive set API
apeteri Apr 25, 2016
17b8c43
[collect] Update primitive list API
apeteri Apr 25, 2016
dcea838
[collect] Update primitive map API
apeteri Apr 25, 2016
3f04170
[collect] Move unmodifiable LongSet and iterator to LongCollections
apeteri Apr 23, 2016
4f1bd8c
[collect] Favor factory methods over duplication support on instances
apeteri Apr 25, 2016
34c90e5
[collect] Update client classes after API changes
apeteri Apr 25, 2016
68b9343
[collect] Restrict filtering to LongSets
apeteri Apr 25, 2016
4934c66
[collect] Remove unused import
apeteri Apr 25, 2016
809f0e5
[collect] Add null check to custom HashFunction factory methods
apeteri Apr 25, 2016
42f6433
[collect] Add equals and hashCode to primitive set implementations
apeteri Apr 25, 2016
17a7bbc
SO-1952: add hashCode and elementsEqual to abstract collection classes
cmark Apr 26, 2016
ec8ecdc
SO-1952: implement equals and hashCode on arraylist wrappers
cmark Apr 26, 2016
664056a
SO-1952: implement equals and hashCode for primitive map wrappers
cmark Apr 26, 2016
033d5f9
SO-1952: organize imports
cmark Apr 26, 2016
612c025
SO-1952: implement explicit hashCode instead of delegate hashcode...
cmark Apr 26, 2016
28aa586
SO-1952: convert fastutil to fragment and use serviceloader...
cmark Apr 26, 2016
f556f7c
SO-1952: update client classes after API changes
cmark Apr 26, 2016
4a1b3d1
[collect] fix equals impl of primitive key object value maps
cmark Apr 27, 2016
8791176
[commons] remove no longer valid IntKeySetMultimap test cases
cmark Apr 27, 2016
bc8880b
[tests] add fastutil fragment as requirement of test execution
cmark Apr 27, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[collect] Update primitive map API
- Add "WithExpectedSize" suffix to method name where a size is expected
  • Loading branch information
apeteri committed Apr 25, 2016
commit dcea8387c9c5a4f35536b99675bc6f8dfc912a3d
Original file line number Diff line number Diff line change
Expand Up @@ -31,40 +31,40 @@
*/
public interface PrimitiveMapFactory {

<V> ByteKeyMap<V> newByteKeyOpenHashMap(int expectedSize);
<V> ByteKeyMap<V> newByteKeyOpenHashMapWithExpectedSize(int expectedSize);

ByteKeyLongMap newByteKeyLongOpenHashMap();

ByteKeyLongMap newByteKeyLongOpenHashMap(int expectedSize);
ByteKeyLongMap newByteKeyLongOpenHashMapWithExpectedSize(int expectedSize);

<V> IntKeyMap<V> newIntKeyOpenHashMap();

<V> IntKeyMap<V> newIntKeyOpenHashMap(int expectedSize);
<V> IntKeyMap<V> newIntKeyOpenHashMapWithExpectedSize(int expectedSize);

LongKeyFloatMap newLongKeyFloatOpenHashMap();

LongKeyFloatMap newLongKeyFloatOpenHashMap(int expectedSize);
LongKeyFloatMap newLongKeyFloatOpenHashMapWithExpectedSize(int expectedSize);

LongKeyIntMap newLongKeyIntOpenHashMap();

LongKeyIntMap newLongKeyIntOpenHashMap(int expectedSize);
LongKeyIntMap newLongKeyIntOpenHashMapWithExpectedSize(int expectedSize);

LongKeyLongMap newLongKeyLongOpenHashMap();

LongKeyLongMap newLongKeyLongOpenHashMap(int expectedSize);
LongKeyLongMap newLongKeyLongOpenHashMapWithExpectedSize(int expectedSize);

<V> LongKeyMap<V> newLongKeyOpenHashMap();

<V> LongKeyMap<V> newLongKeyOpenHashMap(HashFunction hashFunction);

<V> LongKeyMap<V> newLongKeyOpenHashMap(int expectedSize);
<V> LongKeyMap<V> newLongKeyOpenHashMapWithExpectedSize(int expectedSize);

<K> ByteValueMap<K> newObjectKeyByteOpenHashMap();

<K> ByteValueMap<K> newObjectKeyByteOpenHashMap(int expectedSize);
<K> ByteValueMap<K> newObjectKeyByteOpenHashMapWithExpectedSize(int expectedSize);

<K> LongValueMap<K> newObjectKeyLongOpenHashMap();

<K> LongValueMap<K> newObjectKeyLongOpenHashMap(int expectedSize);
<K> LongValueMap<K> newObjectKeyLongOpenHashMapWithExpectedSize(int expectedSize);

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
public class FastUtilPrimitiveMapFactory implements PrimitiveMapFactory {

@Override
public <V> ByteKeyMap<V> newByteKeyOpenHashMap(int expectedSize) {
return ByteKeyMapWrapper.create(expectedSize);
public <V> ByteKeyMap<V> newByteKeyOpenHashMapWithExpectedSize(int expectedSize) {
return ByteKeyMapWrapper.createWithExpectedSize(expectedSize);
}

@Override
Expand All @@ -51,8 +51,8 @@ public ByteKeyLongMap newByteKeyLongOpenHashMap() {
}

@Override
public ByteKeyLongMap newByteKeyLongOpenHashMap(int expectedSize) {
return ByteKeyLongMapWrapper.create(expectedSize);
public ByteKeyLongMap newByteKeyLongOpenHashMapWithExpectedSize(int expectedSize) {
return ByteKeyLongMapWrapper.createWithExpectedSize(expectedSize);
}

@Override
Expand All @@ -61,8 +61,8 @@ public <V> IntKeyMap<V> newIntKeyOpenHashMap() {
}

@Override
public <V> IntKeyMap<V> newIntKeyOpenHashMap(int expectedSize) {
return IntKeyMapWrapper.create(expectedSize);
public <V> IntKeyMap<V> newIntKeyOpenHashMapWithExpectedSize(int expectedSize) {
return IntKeyMapWrapper.createWithExpectedSize(expectedSize);
}

@Override
Expand All @@ -71,8 +71,8 @@ public LongKeyFloatMap newLongKeyFloatOpenHashMap() {
}

@Override
public LongKeyFloatMap newLongKeyFloatOpenHashMap(int expectedSize) {
return LongKeyFloatMapWrapper.create(expectedSize);
public LongKeyFloatMap newLongKeyFloatOpenHashMapWithExpectedSize(int expectedSize) {
return LongKeyFloatMapWrapper.createWithExpectedSize(expectedSize);
}

@Override
Expand All @@ -81,8 +81,8 @@ public LongKeyIntMap newLongKeyIntOpenHashMap() {
}

@Override
public LongKeyIntMap newLongKeyIntOpenHashMap(int expectedSize) {
return LongKeyIntMapWrapper.create(expectedSize);
public LongKeyIntMap newLongKeyIntOpenHashMapWithExpectedSize(int expectedSize) {
return LongKeyIntMapWrapper.createWithExpectedSize(expectedSize);
}

@Override
Expand All @@ -91,8 +91,8 @@ public LongKeyLongMap newLongKeyLongOpenHashMap() {
}

@Override
public LongKeyLongMap newLongKeyLongOpenHashMap(int expectedSize) {
return LongKeyLongMapWrapper.create(expectedSize);
public LongKeyLongMap newLongKeyLongOpenHashMapWithExpectedSize(int expectedSize) {
return LongKeyLongMapWrapper.createWithExpectedSize(expectedSize);
}

@Override
Expand All @@ -101,8 +101,8 @@ public <V> LongKeyMap<V> newLongKeyOpenHashMap() {
}

@Override
public <V> LongKeyMap<V> newLongKeyOpenHashMap(int expectedSize) {
return LongKeyMapWrapper.create(expectedSize);
public <V> LongKeyMap<V> newLongKeyOpenHashMapWithExpectedSize(int expectedSize) {
return LongKeyMapWrapper.createWithExpectedSize(expectedSize);
}

@Override
Expand All @@ -116,8 +116,8 @@ public <K> ByteValueMap<K> newObjectKeyByteOpenHashMap() {
}

@Override
public <K> ByteValueMap<K> newObjectKeyByteOpenHashMap(int expectedSize) {
return ObjectKeyByteMapWrapper.create(expectedSize);
public <K> ByteValueMap<K> newObjectKeyByteOpenHashMapWithExpectedSize(int expectedSize) {
return ObjectKeyByteMapWrapper.createWithExpectedSize(expectedSize);
}

@Override
Expand All @@ -126,8 +126,7 @@ public <K> LongValueMap<K> newObjectKeyLongOpenHashMap() {
}

@Override
public <K> LongValueMap<K> newObjectKeyLongOpenHashMap(int expectedSize) {
return ObjectKeyLongMapWrapper.create(expectedSize);
public <K> LongValueMap<K> newObjectKeyLongOpenHashMapWithExpectedSize(int expectedSize) {
return ObjectKeyLongMapWrapper.createWithExpectedSize(expectedSize);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static ByteKeyLongMap create() {
return new ByteKeyLongMapWrapper(new Byte2LongOpenHashMap());
}

public static ByteKeyLongMap create(int expectedSize) {
public static ByteKeyLongMap createWithExpectedSize(int expectedSize) {
return new ByteKeyLongMapWrapper(new Byte2LongOpenHashMap(expectedSize));
}

Expand All @@ -102,7 +102,7 @@ public static ByteKeyLongMap create(ByteKeyLongMap map) {
final Byte2LongMap sourceDelegate = ((ByteKeyLongMapWrapper) map).delegate;
return new ByteKeyLongMapWrapper(clone(sourceDelegate));
} else {
final ByteKeyLongMap result = create(map.size());
final ByteKeyLongMap result = createWithExpectedSize(map.size());
final ByteIterator iter = map.keySet().iterator();
while (iter.hasNext()) {
final byte key = iter.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public Collection<V> values() {
return delegate.values();
}

public static <V> ByteKeyMap<V> create(int expectedSize) {
public static <V> ByteKeyMap<V> createWithExpectedSize(int expectedSize) {
return new ByteKeyMapWrapper<>(new Byte2ObjectOpenHashMap<V>(expectedSize));
}

Expand All @@ -100,7 +100,7 @@ public static <V> ByteKeyMap<V> create(ByteKeyMap<V> map) {
final Byte2ObjectMap<V> sourceDelegate = ((ByteKeyMapWrapper<V>) map).delegate;
return new ByteKeyMapWrapper<>(clone(sourceDelegate));
} else {
final ByteKeyMap<V> result = create(map.size());
final ByteKeyMap<V> result = createWithExpectedSize(map.size());
final ByteIterator iter = map.keySet().iterator();
while (iter.hasNext()) {
final byte key = iter.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static <V> IntKeyMap<V> create() {
return new IntKeyMapWrapper<>(new Int2ObjectOpenHashMap<V>());
}

public static <V> IntKeyMap<V> create(int expectedSize) {
public static <V> IntKeyMap<V> createWithExpectedSize(int expectedSize) {
return new IntKeyMapWrapper<>(new Int2ObjectOpenHashMap<V>(expectedSize));
}

Expand All @@ -100,7 +100,7 @@ public static <V> IntKeyMap<V> create(IntKeyMap<V> map) {
final Int2ObjectMap<V> sourceDelegate = ((IntKeyMapWrapper<V>) map).delegate;
return new IntKeyMapWrapper<>(clone(sourceDelegate));
} else {
final IntKeyMap<V> result = create(map.size());
final IntKeyMap<V> result = createWithExpectedSize(map.size());
final IntIterator iter = map.keySet().iterator();
while (iter.hasNext()) {
final int key = iter.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private LongKeyFloatMap create(LongKeyFloatMap map) {
final Long2FloatMap sourceDelegate = ((LongKeyFloatMapWrapper) map).delegate;
return new LongKeyFloatMapWrapper(clone(sourceDelegate));
} else {
final LongKeyFloatMap result = create(map.size());
final LongKeyFloatMap result = createWithExpectedSize(map.size());
final LongIterator keys = map.keySet().iterator();
while (keys.hasNext()) {
final long key = keys.next();
Expand All @@ -110,7 +110,7 @@ public static LongKeyFloatMap create() {
return new LongKeyFloatMapWrapper(new Long2FloatOpenHashMap());
}

public static LongKeyFloatMap create(int expectedSize) {
public static LongKeyFloatMap createWithExpectedSize(int expectedSize) {
return new LongKeyFloatMapWrapper(new Long2FloatOpenHashMap(expectedSize));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private LongKeyIntMap create(LongKeyIntMap map) {
final Long2IntMap sourceDelegate = ((LongKeyIntMapWrapper) map).delegate;
return new LongKeyIntMapWrapper(clone(sourceDelegate));
} else {
final LongKeyIntMap result = create(map.size());
final LongKeyIntMap result = createWithExpectedSize(map.size());
final LongIterator keys = map.keySet().iterator();
while (keys.hasNext()) {
final long key = keys.next();
Expand All @@ -110,7 +110,7 @@ public static LongKeyIntMap create() {
return new LongKeyIntMapWrapper(new Long2IntOpenHashMap());
}

public static LongKeyIntMap create(int expectedSize) {
public static LongKeyIntMap createWithExpectedSize(int expectedSize) {
return new LongKeyIntMapWrapper(new Long2IntOpenHashMap(expectedSize));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private LongKeyLongMap create(LongKeyLongMap map) {
final Long2LongMap sourceDelegate = ((LongKeyLongMapWrapper) map).delegate;
return new LongKeyLongMapWrapper(clone(sourceDelegate));
} else {
final LongKeyLongMap result = create(map.size());
final LongKeyLongMap result = createWithExpectedSize(map.size());
final LongIterator keys = map.keySet().iterator();
while (keys.hasNext()) {
final long key = keys.next();
Expand All @@ -110,7 +110,7 @@ public static LongKeyLongMap create() {
return new LongKeyLongMapWrapper(new Long2LongOpenHashMap());
}

public static LongKeyLongMap create(int expectedSize) {
public static LongKeyLongMap createWithExpectedSize(int expectedSize) {
return new LongKeyLongMapWrapper(new Long2LongOpenHashMap(expectedSize));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static <V> LongKeyMap<V> create(LongKeyMap<V> map) {
final Long2ObjectMap<V> sourceDelegate = ((LongKeyMapWrapper<V>) map).delegate;
return new LongKeyMapWrapper<>(clone(sourceDelegate));
} else {
final LongKeyMap<V> result = create(map.size());
final LongKeyMap<V> result = createWithExpectedSize(map.size());
final LongIterator iter = map.keySet().iterator();
while (iter.hasNext()) {
final long key = iter.next();
Expand All @@ -111,7 +111,7 @@ public static <V> LongKeyMap<V> create(HashFunction hashFunction) {
return new LongKeyMapWrapper<>(new Long2ObjectOpenCustomHashMap<V>(new LongHashStrategyWrapper(hashFunction)));
}

public static <V> LongKeyMap<V> create(int expectedSize) {
public static <V> LongKeyMap<V> createWithExpectedSize(int expectedSize) {
return new LongKeyMapWrapper<>(new Long2ObjectOpenHashMap<V>(expectedSize));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static <K> ByteValueMap<K> create(ByteValueMap<K> map) {
final Object2ByteMap<K> sourceDelegate = ((ObjectKeyByteMapWrapper<K>) map).delegate;
return new ObjectKeyByteMapWrapper<>(clone(sourceDelegate));
} else {
final ByteValueMap<K> result = create(map.size());
final ByteValueMap<K> result = createWithExpectedSize(map.size());
final Iterator<K> keys = map.keySet().iterator();
while (keys.hasNext()) {
final K key = keys.next();
Expand All @@ -109,7 +109,7 @@ public static <K> ByteValueMap<K> create(ByteValueMap<K> map) {
}
}

public static <K> ByteValueMap<K> create(int expectedSize) {
public static <K> ByteValueMap<K> createWithExpectedSize(int expectedSize) {
return new ObjectKeyByteMapWrapper<>(new Object2ByteOpenHashMap<K>(expectedSize));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static <K> LongValueMap<K> create(LongValueMap<K> map) {
final Object2LongMap<K> sourceDelegate = ((ObjectKeyLongMapWrapper<K>) map).delegate;
return new ObjectKeyLongMapWrapper<>(clone(sourceDelegate));
} else {
final LongValueMap<K> result = create(map.size());
final LongValueMap<K> result = createWithExpectedSize(map.size());
final Iterator<K> keys = map.keySet().iterator();
while (keys.hasNext()) {
final K key = keys.next();
Expand All @@ -109,7 +109,7 @@ public static <K> LongValueMap<K> create(LongValueMap<K> map) {
}
}

public static <K> LongValueMap<K> create(int expectedSize) {
public static <K> LongValueMap<K> createWithExpectedSize(int expectedSize) {
return new ObjectKeyLongMapWrapper<>(new Object2LongOpenHashMap<K>(expectedSize));
}

Expand Down
Loading