Skip to content

Commit

Permalink
Improvements to ObjectMap extendability
Browse files Browse the repository at this point in the history
  • Loading branch information
ME1312 committed Oct 22, 2021
1 parent c1d4454 commit b571cfe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Expand Up @@ -24,9 +24,10 @@ public abstract class Pair<K, V> extends Value<V> {

@Override
public String toString() {
return '[' + String.valueOf(key()) + ", " + String.valueOf(value()) + ')';
return '[' + String.valueOf(key()) + ", " + super.toString() + ')';
}

@SuppressWarnings("rawtypes")
@Override
public boolean equals(Object object) {
if (object instanceof Pair) {
Expand Down
Expand Up @@ -26,6 +26,7 @@ public String toString() {
return String.valueOf(value());
}

@SuppressWarnings("rawtypes")
@Override
public boolean equals(Object object) {
if (object instanceof Value) {
Expand Down
Expand Up @@ -97,7 +97,7 @@ public Set<K> getKeys() {
*
* @return Values
*/
public Collection<ObjectMapValue<K>> getValues() {
public Collection<? extends ObjectMapValue<K>> getValues() {
return map.values();
}

Expand Down Expand Up @@ -332,7 +332,7 @@ public ObjectMapValue<K> get(K handle, ObjectMapValue<K> def) {
* @param handle Handle
* @return Object
*/
public List<ObjectMapValue<K>> getList(K handle) {
public List<? extends ObjectMapValue<K>> getList(K handle) {
if (Util.isNull(handle)) throw new NullPointerException();
return map.get(handle).asList();
}
Expand All @@ -344,7 +344,7 @@ public List<ObjectMapValue<K>> getList(K handle) {
* @param def Default
* @return Object List
*/
public List<ObjectMapValue<K>> getList(K handle, Collection<?> def) {
public List<? extends ObjectMapValue<K>> getList(K handle, Collection<?> def) {
if (Util.isNull(handle)) throw new NullPointerException();
if (map.get(handle) != null) {
return getList(handle);
Expand All @@ -364,7 +364,7 @@ public List<ObjectMapValue<K>> getList(K handle, Collection<?> def) {
* @param def Default
* @return Object List
*/
public List<ObjectMapValue<K>> getList(K handle, List<? extends ObjectMapValue<K>> def) {
public List<? extends ObjectMapValue<K>> getList(K handle, List<? extends ObjectMapValue<K>> def) {
if (Util.isNull(handle)) throw new NullPointerException();
if (map.get(handle) != null) {
return getList(handle);
Expand Down Expand Up @@ -500,7 +500,7 @@ public ObjectMap<K> getMap(K handle, ObjectMap<? extends K> def) {
* @param handle Handle
* @return Object Map List
*/
public List<ObjectMap<K>> getMapList(K handle) {
public List<? extends ObjectMap<K>> getMapList(K handle) {
return get(handle, x).asMapList();
}

Expand All @@ -511,7 +511,7 @@ public List<ObjectMap<K>> getMapList(K handle) {
* @param def Default
* @return Object Map List
*/
public List<ObjectMap<K>> getMapList(K handle, Collection<? extends Map<? extends K, ?>> def) {
public List<? extends ObjectMap<K>> getMapList(K handle, Collection<? extends Map<? extends K, ?>> def) {
return get(handle, def).asMapList();
}

Expand All @@ -522,7 +522,7 @@ public List<ObjectMap<K>> getMapList(K handle, Collection<? extends Map<? extend
* @param def Default
* @return Object Map List
*/
public List<ObjectMap<K>> getMapList(K handle, List<? extends ObjectMap<? extends K>> def) {
public List<? extends ObjectMap<K>> getMapList(K handle, List<? extends ObjectMap<? extends K>> def) {
if (Util.isNull(handle)) throw new NullPointerException();
if (map.get(handle) != null) {
return get(handle).asMapList();
Expand Down

0 comments on commit b571cfe

Please sign in to comment.