Object[] result = new Object[messages.size()]; ListIterator it = messages.listIterator(); int i = 0; while (it.hasNext()) { result[i++] = ((MessageNode) it.next()).getUid(); } return result;
AbstractColumbaAction[] actions = new AbstractColumbaAction[list.size()]; Iterator it = list.iterator(); int i = 0; while (it.hasNext()) { actions[i++] = ((AbstractMailCheckingAction) it.next()); } return actions;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/table/selection/TableSelectionHandler.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/mailchecking/MailCheckingManager.java
Method name: Object[] getUidArray() Method name: AbstractColumbaAction[] getActions()
Number of AST nodes: 6 Number of AST nodes: 6
1
Object[] result = new Object[messages.size()];
1
AbstractColumbaAction[] actions = new AbstractColumbaAction[list.size()];
2
		List
3
Iterator it = messages.listIterator();
2
        Iterator it = list.iterator();
4
		int i = 0;
3
        int i = 0;
5
		while (it.hasNext()) {
4
        while (it.hasNext()) {
6
			result[i++] = ((MessageNode) it.next()).getUid();
7
		}
8
		return result
5
            actions[i++] = ((AbstractMailCheckingAction) it.next());
6
        }
9
;
7
        return actions;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are in different classes
Number of node comparisons20
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                        
    1
    AbstractColumbaAction[] actions = new AbstractColumbaAction[list.size()];
    1
    Object[] result = new Object[messages.size()];
                                                                                                  
                                                                  
    2
    Iterator it = list.iterator();
    2
    ListIterator it = messages.listIterator();
                                                                                          
    3
    int i = 0;
    3
    int i = 0;
    4
    while (it.hasNext())
    4
    while (it.hasNext())
    4
    while (it.hasNext())
    Differences
    Expression1Expression2Difference
    java.util.ListIteratorjava.util.IteratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.ListIterator of variable it does not match with type java.util.Iterator of variable it
    • Make classes java.util.ListIterator and java.util.Iterator extend a common superclass
    4
    while (it.hasNext())
                                                                                                                    
    5
    actions[i++] = ((AbstractMailCheckingAction)it.next());
    Preondition Violations
    Unmatched statement actions[i++]=((AbstractMailCheckingAction)it.next()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    actions[i++] = ((AbstractMailCheckingAction)it.next());
    5
    result[i++] = ((MessageNode)it.next()).getUid();
    5
    result[i++] = ((MessageNode)it.next()).getUid();
    Preondition Violations
    Unmatched statement result[i++]=((MessageNode)it.next()).getUid(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                      
                                        
    6
    return actions;
    Preondition Violations
    Unmatched return actions;
    6
    return actions;
    6
    return result;
    6
    return result;
    Preondition Violations
    Unmatched return result;
                                      
    Precondition Violations (5)
    Row Violation
    1Type java.util.ListIterator of variable it does not match with type java.util.Iterator of variable it
    2Unmatched statement actions[i++]=((AbstractMailCheckingAction)it.next()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement result[i++]=((MessageNode)it.next()).getUid(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return actions;
    5Unmatched return result;