Optimize xsql's use of collections

Rather than performing class comparisons, we perform a simple
instanceof check... and then rather than adding items one at a time, we
use Collections.addAll().

Change-Id: I2e73788ab6f1625291970ad9b32d3b5d18ee8205
Signed-off-by: Robert Varga <rovarga@cisco.com>
Merge "Optimize xsql's use of collections"