Code example for LinkedList

Methods: add, contains

0
                                           targetLock,
                                           threadId,
                                           -1, 
                                           -1); 
        sourceLock.addOutgoingEdge(edge);
        if (!mNodes.contains(sourceLock)) {
            mNodes.add(sourceLock);
        } 
        if (!mNodes.contains(sourceLock)) {
            mNodes.add(sourceLock);
        } 
        return edge;
    } 
 
    private void addExpectedCycle(LockEdge[] edges) {
        Cycle cycle = new Cycle(Arrays.asList(edges));
        mExpectedCycles.add(cycle);
    } 
 
    private void assertExpectedCycles() { 
        Assert.assertEquals(mExpectedCycles, mCycleDetector.getCycles());
    } 
 
    @Test 
    public void testNoCycle() throws Exception { 
        addEdge(1, 2); 
        addEdge(2, 3); 
        addEdge(1, 3); 
        addEdge(3, 4); 
        mCycleDetector.analyzeLockNodes(mNodes);
        assertExpectedCycles(); 
    } 
 
    @Test 
    public void testSmallCycle() throws Exception {