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,17 +126,13 @@ public class DefaultChannelGroup extends AbstractSet<Channel> implements Channel
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(Object o) {
|
public boolean contains(Object o) {
|
||||||
if (o instanceof Channel) {
|
|
||||||
Channel c = (Channel) o;
|
|
||||||
if (o instanceof ServerChannel) {
|
if (o instanceof ServerChannel) {
|
||||||
return serverChannels.containsValue(c);
|
return serverChannels.containsValue(o);
|
||||||
} else {
|
} else if (o instanceof Channel) {
|
||||||
return nonServerChannels.containsValue(c);
|
return nonServerChannels.containsValue(o);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean add(Channel channel) {
|
public boolean add(Channel channel) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user