package com.getbase.android.db.provider;

import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;

import java.util.Collections;
import java.util.List;

class Selection {

  private static final Function<String, String> SURROUND_WITH_PARENS = new Function<String, String>() {
    @Override
    public String apply(String input) {
      return "(" + input + ")";
    }
  };

  private final List<String> selection = Lists.newLinkedList();
  private final List<Object> selectionArgs = Lists.newLinkedList();

  void append(String selection, Object... selectionArgs) {
    this.selection.add(selection);
    Collections.addAll(this.selectionArgs, selectionArgs);
  }

  String getSelection() {
    if (selection.isEmpty()) {
      return null;
    }
    return Joiner.on(" AND ").join(Collections2.transform(selection, SURROUND_WITH_PARENS));
  }

  String[] getSelectionArgs() {
    if (selectionArgs.isEmpty()) {
      return null;
    }
    return Collections2.transform(selectionArgs, new Function<Object, String>() {
      @Override
      public String apply(Object object) {
        return object.toString();
      }
    }).toArray(new String[selectionArgs.size()]);
  }
}

@@ -75,16 +75,57 @@
 nction;%0A
+import com.google.common.base.Functions;%0A
 import c
@@ -1128,20 +1128,16 @@
 ionArgs,
- new
  Functio
@@ -1141,135 +1141,28 @@
 tion
-%3CObject, String%3E() %7B%0A      @Override%0A      public String apply(Object object) %7B%0A        return object.toString();%0A      %7D%0A    %7D
+s.toStringFunction()
 ).to

Use built-in function