@Test public void buildCollectionQuery_multiple() { SqlUtil.Query updateQuery = SqlUtil.buildCollectionQuery("a", Arrays.asList(1, 2, 3)); assertEquals("a IN (?, ?, ?)", updateQuery.getWhere()); assertArrayEquals(new String[] { "1", "2", "3" }, updateQuery.getWhereArgs()); }
public static @NonNull Query buildCollectionQuery(@NonNull String column, @NonNull Collection<? extends Object> values) { Preconditions.checkArgument(values.size() > 0); StringBuilder query = new StringBuilder(); Object[] args = new Object[values.size()]; int i = 0; for (Object value : values) { query.append("?"); args[i] = value; if (i != values.size() - 1) { query.append(", "); } i++; } return new Query(column + " IN (" + query.toString() + ")", buildArgs(args)); }
SqlUtil { public static @NonNull Query buildCollectionQuery(@NonNull String column, @NonNull Collection<? extends Object> values) { Preconditions.checkArgument(values.size() > 0); StringBuilder query = new StringBuilder(); Object[] args = new Object[values.size()]; int i = 0; for (Object value : values) { query.append("?"); args[i] = value; if (i != values.size() - 1) { query.append(", "); } i++; } return new Query(column + " IN (" + query.toString() + ")", buildArgs(args)); } }
SqlUtil { public static @NonNull Query buildCollectionQuery(@NonNull String column, @NonNull Collection<? extends Object> values) { Preconditions.checkArgument(values.size() > 0); StringBuilder query = new StringBuilder(); Object[] args = new Object[values.size()]; int i = 0; for (Object value : values) { query.append("?"); args[i] = value; if (i != values.size() - 1) { query.append(", "); } i++; } return new Query(column + " IN (" + query.toString() + ")", buildArgs(args)); } private  SqlUtil(); }
SqlUtil { public static @NonNull Query buildCollectionQuery(@NonNull String column, @NonNull Collection<? extends Object> values) { Preconditions.checkArgument(values.size() > 0); StringBuilder query = new StringBuilder(); Object[] args = new Object[values.size()]; int i = 0; for (Object value : values) { query.append("?"); args[i] = value; if (i != values.size() - 1) { query.append(", "); } i++; } return new Query(column + " IN (" + query.toString() + ")", buildArgs(args)); } private  SqlUtil(); static boolean tableExists(@NonNull SQLiteDatabase db, @NonNull String table); static boolean columnExists(@NonNull SQLiteDatabase db, @NonNull String table, @NonNull String column); static String[] buildArgs(Object... objects); static @NonNull Query buildTrueUpdateQuery(@NonNull String selection,
                                                    @NonNull String[] args,
                                                    @NonNull ContentValues contentValues); static @NonNull Query buildCollectionQuery(@NonNull String column, @NonNull Collection<? extends Object> values); static String[] appendArg(@NonNull String[] args, String addition); }
SqlUtil { public static @NonNull Query buildCollectionQuery(@NonNull String column, @NonNull Collection<? extends Object> values) { Preconditions.checkArgument(values.size() > 0); StringBuilder query = new StringBuilder(); Object[] args = new Object[values.size()]; int i = 0; for (Object value : values) { query.append("?"); args[i] = value; if (i != values.size() - 1) { query.append(", "); } i++; } return new Query(column + " IN (" + query.toString() + ")", buildArgs(args)); } private  SqlUtil(); static boolean tableExists(@NonNull SQLiteDatabase db, @NonNull String table); static boolean columnExists(@NonNull SQLiteDatabase db, @NonNull String table, @NonNull String column); static String[] buildArgs(Object... objects); static @NonNull Query buildTrueUpdateQuery(@NonNull String selection,
                                                    @NonNull String[] args,
                                                    @NonNull ContentValues contentValues); static @NonNull Query buildCollectionQuery(@NonNull String column, @NonNull Collection<? extends Object> values); static String[] appendArg(@NonNull String[] args, String addition);  }