Simplify DefaultChannelGroup.contains(...) and so remove one instanceof check.
Motivation: DefaultChannelGroup.contains(...) did one more instanceof check then needed. Modifications: Simplify contains(...) and remove one instanceof check. Result: Simplier and cheaper implementation.
This commit is contained in:
parent
de082bf4c7
commit
0adccfdb50
|
@ -126,16 +126,12 @@ public class DefaultChannelGroup extends AbstractSet<Channel> implements Channel
|
|||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
if (o instanceof Channel) {
|
||||
Channel c = (Channel) o;
|
||||
if (o instanceof ServerChannel) {
|
||||
return serverChannels.containsValue(c);
|
||||
} else {
|
||||
return nonServerChannels.containsValue(c);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
if (o instanceof ServerChannel) {
|
||||
return serverChannels.containsValue(o);
|
||||
} else if (o instanceof Channel) {
|
||||
return nonServerChannels.containsValue(o);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user