polymorphism with object ArrayList
This is missing the point of polymorphism. Its great strength is that you don't need to know or care about the type. With your code, you still need to check type using the instanceof operator. 

One way to resolve this is using a variation on the command pattern. First, define a common interface (I used an abstract class) that all three implementations can inherit from. Let call it QueryParameter:

abstract class QueryParameter {
    protected final int index;

    public QueryParameter(int index) {
        this.index = index;
    }

    public abstract void addTo(QueryStatement queryStatement);

}


Now you define three implementations. Here is the String version:

class StringParameter extends QueryParameter {
    private final String value;

    public StringParameter(String value, int index) {
        super(index);
        this.value = value;
    }

    @Override
    public void addTo(QueryStatement queryStatement) {
        queryStatement.setString(index, value);
    }

}


Now, you may construct an arbitrary number of parameters and save them in a collection. Once you've got your QueryStatement ready, simply call the addTo() methods of every parameter in no particular order and you're done!

final Set&lt;QueryParameter&gt; params = new HashSet&lt;&gt;();
//Add bunch of parameters.
params.stream().forEach((param) -&gt; param.addTo(queryStatement));


Of course there are many ways to go about doing this, my example is not necessarily the best fit for you.