package com.novoda.notils.string;

import java.util.Arrays;

public class QueryUtils {

    /**
     * Creates a string to be used as a placeholder in {@link android.content.ContentResolver} operations selection.
     * This will allow to use more selection arguments and have them replaced when using the IN operator.
     *
     * @param size The number of selection arguments
     * @return Example: for size == 3 : "?, ?, ?"
     */
    public static String createSelectionPlaceholdersOfSize(int size) {
        String[] questionMarks = new String[size];
        for (int i = 0; i < size; i++) {
            questionMarks[i] = "?";
        }

        return StringUtils.join(Arrays.asList(questionMarks), ", ");
    }

}

@@ -32,34 +32,8 @@
 g;%0A%0A
-import java.util.Arrays;%0A%0A
 publ
@@ -487,126 +487,297 @@
     
-String%5B%5D questionMarks = new String%5Bsize%5D;%0A        for (int i = 0; i %3C size; i++) %7B%0A            questionMarks%5Bi
+if (size == 0) %7B%0A            return %22%22;%0A        %7D%0A%0A        int sizeOfResult = size * 3 - 2;%0A        char%5B%5D result = new char%5BsizeOfResult%5D;%0A        for (int i = 0; i %3C sizeOfResult - 1; i += 3) %7B%0A            result%5Bi%5D = '?';%0A            result%5Bi + 1%5D = ',';%0A            result%5Bi + 2
 %5D = 
-%22?%22
+' '
 ;%0A  
@@ -775,32 +775,72 @@
 = ' ';%0A        %7D
+%0A        result%5BsizeOfResult - 1%5D = '?';
 %0A%0A        return
@@ -844,59 +844,25 @@
 urn 
+new 
 String
-Utils.join(Arrays.asList(questionMarks), %22, %22
+(result
 );%0A 

Optimize createSelectionPlaceholdersOfSize