Code example for CopyOnWriteArrayList

0
    } 
 
    public AbstractEventBusTest(boolean collectEventsReceived) {
        super(Application.class);
        if (collectEventsReceived) {
            eventsReceived = new CopyOnWriteArrayList<Object>();
        } else { 
            eventsReceived = null;
        } 
    } 
 
    protected void setUp() throws Exception { 
        super.setUp(); 
        EventBus.clearCaches(); 
        EventBus.clearSkipMethodNameVerifications(); 
        eventBus = new EventBus();
        mainPoster = new EventPostHandler(Looper.getMainLooper());
        assertFalse(Looper.getMainLooper().getThread().equals(Thread.currentThread()));
    } 
 
    protected void postInMainThread(Object event) {