Skip to content

Commit

Permalink
feat(constructor): Add constructors to ConcurrentObjectMap, HashObjec…
Browse files Browse the repository at this point in the history
…tMap, LinkedObjectMap, and TreeObjectMap
  • Loading branch information
GeorgeV220 committed Sep 22, 2023
1 parent facdf8c commit 68c2075
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,25 @@ public ConcurrentObjectMap(final Map<K, V> map) {
putAll(map);
}

/**
* Constructs a new ConcurrentObjectMap with the specified initial capacity.
*
* @param initialCapacity The initial capacity of the ConcurrentObjectMap.
*/
public ConcurrentObjectMap(final int initialCapacity) {
super(initialCapacity);
}

/**
* Constructs a new ConcurrentObjectMap with the specified initial capacity and load factor.
*
* @param initialCapacity The initial capacity of the ConcurrentObjectMap.
* @param loadFactor The load factor of the ConcurrentObjectMap.
*/
public ConcurrentObjectMap(final int initialCapacity, final float loadFactor) {
super(initialCapacity, loadFactor);
}

/**
* Put/replace the given key/value pair into this User and return this. Useful for chaining puts in a single expression, e.g.
* <pre>
Expand Down
21 changes: 20 additions & 1 deletion maps/src/main/java/com/georgev22/library/maps/HashObjectMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,25 @@ public HashObjectMap(final Map<K, V> map) {
putAll(map);
}

/**
* Constructs a new HashObjectMap with the specified initial capacity.
*
* @param initialCapacity The initial capacity of the HashObjectMap.
*/
public HashObjectMap(final int initialCapacity) {
super(initialCapacity);
}

/**
* Constructs a new HashObjectMap with the specified initial capacity and load factor.
*
* @param initialCapacity The initial capacity of the HashObjectMap.
* @param loadFactor The load factor of the HashObjectMap.
*/
public HashObjectMap(final int initialCapacity, final float loadFactor) {
super(initialCapacity, loadFactor);
}

/**
* Put/replace the given key/value pair into this User and return this. Useful for chaining puts in a single expression, e.g.
* <pre>
Expand Down Expand Up @@ -72,7 +91,7 @@ public ObjectMap<K, V> append(@NotNull ObjectMap<K, V> map) {
}

/**
* Put/replace the given key/value pair into ConcurrentObjectMap if boolean is true and return this. Useful for chaining puts in a single expression, e.g.
* Put/replace the given key/value pair into HashObjectMap if boolean is true and return this. Useful for chaining puts in a single expression, e.g.
* <pre>
* user.append("a", 1, check1).append("b", 2, check2)}
* </pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,25 @@ public LinkedObjectMap(final Map<K, V> map) {
putAll(map);
}

/**
* Constructs a new LinkedObjectMap with the specified initial capacity.
*
* @param initialCapacity The initial capacity of the LinkedObjectMap.
*/
public LinkedObjectMap(final int initialCapacity) {
super(initialCapacity);
}

/**
* Constructs a new LinkedObjectMap with the specified initial capacity and load factor.
*
* @param initialCapacity The initial capacity of the LinkedObjectMap.
* @param loadFactor The load factor of the LinkedObjectMap.
*/
public LinkedObjectMap(final int initialCapacity, final float loadFactor) {
super(initialCapacity, loadFactor);
}

/**
* Put/replace the given key/value pair into this User and return this. Useful for chaining puts in a single expression, e.g.
* <pre>
Expand Down Expand Up @@ -72,7 +91,7 @@ public ObjectMap<K, V> append(@NotNull ObjectMap<K, V> map) {
}

/**
* Put/replace the given key/value pair into ConcurrentObjectMap if boolean is true and return this. Useful for chaining puts in a single expression, e.g.
* Put/replace the given key/value pair into LinkedObjectMap if boolean is true and return this. Useful for chaining puts in a single expression, e.g.
* <pre>
* user.append("a", 1, check1).append("b", 2, check2)}
* </pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public ObjectMap<K, V> append(@NotNull ObjectMap<K, V> map) {
}

/**
* Put/replace the given key/value pair into ConcurrentObjectMap if boolean is true and return this. Useful for chaining puts in a single expression, e.g.
* Put/replace the given key/value pair into TreeObjectMap if boolean is true and return this. Useful for chaining puts in a single expression, e.g.
* <pre>
* user.append("a", 1, check1).append("b", 2, check2)}
* </pre>
Expand Down

0 comments on commit 68c2075

Please sign in to comment.