zrlw commented on code in PR #16395:
URL: https://github.com/apache/dubbo/pull/16395#discussion_r3655764653
##########
dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/state/BitList.java:
##########
@@ -114,16 +114,26 @@ public synchronized E getByIndex(int index) {
}
/**
- * And operation between two bitList. Return a new cloned list.
- * TailList in source bitList will be totally saved even if it is not
appeared in the target bitList.
+ * And operation between two bitList.
*
* @param target target bitList
- * @return this bitList only contains those elements contain in both two
list and source bitList's tailList
+ * @return this bitList only contains elements contained in both lists
*/
public synchronized BitList<E> and(BitList<E> target) {
- rootSet.and(target.rootSet);
- if (target.getTailList() != null) {
- target.getTailList().forEach(this::addToTailList);
+ if (originList == target.originList) {
Review Comment:
using ```equals``` if you want comparing two different list objects which
contain same items,
and if you don't care the item order in them , you should sort them before
calling ```equals```.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]