To store a list of listeners , as long as the list remains mutable and may be accessed by multiple threads , you must either lock the entire list during iteration or clone it before iteration , both of which have a significant cost 來存放一個偵聽器列表,那么只要該列表是可變的,而且可能要被多個線程訪問,您就必須要么在對其進行迭代操作期間,要么在迭代前進行的克隆操作期間,鎖定整個列表,這兩種做法的開銷都很大。