fix(container): NullPointerException when trying to query a key which is not in the container yet
This commit is contained in:
parent
79dcc25afc
commit
cad019e44a
@ -3,6 +3,7 @@ package net.tomatentum.cutin.container;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -47,7 +48,8 @@ public class LoneMethodContainer<I extends Object, C extends Object> implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<ReflectedMethod<I, C>> findFor(I identifier) {
|
public Collection<ReflectedMethod<I, C>> findFor(I identifier) {
|
||||||
return Arrays.asList(this.methodStore.get(identifier));
|
ReflectedMethod<I, C> result = this.methodStore.get(identifier);
|
||||||
|
return result != null ? Arrays.asList(result) : Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user