package com.github.ahitrin.jqexample;

import java.util.Arrays;
import java.util.List;

/**
 * @author Andrey Hitrin
 * @since 25.09.14
 */
public class PrimeFactors
{
    public static List<Integer> extract(Integer number)
    {
        if (number % 2 == 0)
            return Arrays.asList(2, number / 2);
        if (number % 3 == 0)
            return Arrays.asList(3, number / 3);
        return Arrays.asList(number);
    }
}

@@ -54,17 +54,20 @@
 il.Array
-s
+List
 ;%0Aimport
@@ -226,34 +226,171 @@
 )%0A    %7B%0A        
-if
+List%3CInteger%3E factors = new ArrayList%3C%3E();%0A        for (int divisor = 2; divisor %3C=7; divisor++) %7B%0A            while ((number %3E divisor) &&
  (number %25 2 == 
@@ -388,15 +388,24 @@
 r %25 
-2
+divisor
  == 0)
+) %7B
 %0A   
@@ -417,31 +417,58 @@
     
-return Arrays.asList(2,
+    factors.add(divisor);%0A                number =
  num
@@ -477,10 +477,15 @@
 r / 
-2)
+divisor
 ;%0A  
@@ -494,28 +494,13 @@
     
-if (number %25 3 == 0)
+    %7D
 %0A   
@@ -508,46 +508,36 @@
     
+%7D%0A
     
-return Arrays.asList(3, 
+    factors.add(
 number
- / 3
 );%0A 
@@ -554,29 +554,15 @@
 urn 
-Arrays.asList(number)
+factors
 ;%0A  

Make tests pass!