Iterator iter = coll.iterator(); int[] arr = new int[ coll.size() ]; int i=0; while( iter.hasNext() ) { arr[i++] = ( (Integer) iter.next() ).intValue(); } return arr;
Iterator iter = coll.iterator(); boolean[] arr = new boolean[ coll.size() ]; int i=0; while( iter.hasNext() ) { arr[i++] = ( (Boolean) iter.next() ).booleanValue(); } return arr;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/util/ArrayHelper.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/util/ArrayHelper.java
Method name: int[] toIntArray(Collection) Method name: boolean[] toBooleanArray(Collection)
Number of AST nodes: 6 Number of AST nodes: 6
1
Iterator iter = coll.iterator();
1
Iterator iter = coll.iterator();
2
		int[] arr = new int[ coll.size() ];
2
		boolean[] arr = new boolean[ coll.size() ];
3
		int i=0;
3
		int i=0;
4
		while( iter.hasNext() ) {
4
		while( iter.hasNext() ) {
5
			arr[i++] = ( (Integer) iter.next() ).intValue();
5
			arr[i++] = ( (Boolean) iter.next() ).booleanValue();
6
		}
6
		}
7
		return arr;
7
		return arr;
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 declared in the same class
Number of node comparisons20
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Iterator iter = coll.iterator();
    1
    Iterator iter = coll.iterator();
                                                                                        
    2
    boolean[] arr = new boolean[coll.size()];
    2
    int[] arr = new int[coll.size()];
                                                                        
    3
    int i = 0;
    3
    int i = 0;
    4
    while (iter.hasNext())
    4
    while (iter.hasNext())
                                                                                                        
    5
    arr[i++] = ((Boolean)iter.next()).booleanValue();
    Preondition Violations
    Unmatched statement arr[i++]=((Boolean)iter.next()).booleanValue(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    arr[i++] = ((Boolean)iter.next()).booleanValue();
    5
    arr[i++] = ((Integer)iter.next()).intValue();
    5
    arr[i++] = ((Integer)iter.next()).intValue();
    Preondition Violations
    Unmatched statement arr[i++]=((Integer)iter.next()).intValue(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                
                                
    6
    return arr;
    Preondition Violations
    Unmatched return arr;
    6
    return arr;
    6
    return arr;
    6
    return arr;
    Preondition Violations
    Unmatched return arr;
                                
    Precondition Violations (5)
    Row Violation
    1Unmatched statement arr[i++]=((Boolean)iter.next()).booleanValue(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement arr[i++]=((Integer)iter.next()).intValue(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched return arr;
    4Unmatched return arr;
    5Clone fragment #1 returns variables iter, i , while Clone fragment #2 returns variables iter, i