public final ArrayList<String> selectUniqueSteamApps(final ArrayList<String> given){
  final ArrayList<String> toReturn=new ArrayList<>();
  toReturn.addAll(given);
  String sql="SELECT fldAppKey FROM tblSteamApp WHERE fldAppKey IN(";
  for (int i=0; i < given.size(); i++) {
    sql+="?";
    sql+=(i + 1 == given.size()) ? ")" : ",";
  }
  if (!sql.endsWith(")"))   sql+=")";
  try (PreparedStatement statement=connection.prepareStatement(sql)){
    for (int i=0; i < given.size(); i++)     statement.setString(i + 1,given.get(i));
    final ResultSet set=statement.executeQuery();
    while (set.next())     toReturn.remove(set.getString("fldAppKey"));
    set.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return toReturn;
}

public final ArrayList < String > selectUniqueSteamApps ( final ArrayList < String > given ) { final ArrayList < String > toReturn = new ArrayList < > ( ) ; toReturn . addAll ( given ) ; String sql = "SELECT fldAppKey FROM tblSteamApp WHERE fldAppKey IN(" ; for ( int i = 0 ; i < given . size ( ) ; i ++ ) { sql += "?" ; sql += ( i + 1 == given . size ( ) ) ? ")" : "," ; } if ( ! sql . endsWith ( ")" ) ) sql += ")" ; try ( PreparedStatement statement = connection . prepareStatement ( sql ) ) { for ( int i = 0 ; i < given . size ( ) ; i ++ ) statement . setString ( i + 1 , given . get ( i ) ) ; final ResultSet set = statement . executeQuery ( ) ; while ( set . next ( ) ) toReturn . remove ( set . getString ( "fldAppKey" ) ) ; set . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return toReturn ; }
when given a list of steam application keys , will return all the application keys that were given that aren ' t in the database .
