Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1105681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:40:15+00:00 2026-05-17T01:40:15+00:00

ArrayList queryParms = new ArrayList(); StringBuffer sql = new StringBuffer(); sql.append( SELECT A.FLDREC_NUM, +

  • 0
ArrayList queryParms = new ArrayList();
StringBuffer sql = new StringBuffer();
sql.append(
"SELECT A.FLDREC_NUM, " +
"@CHARDATE(A.FLDDATE), " +
"T.FLDDESCR, @DEC(A.FLDLEVEL,3) " +
" FROM @SCHEMAALCOHOL A LEFT OUTER JOIN @SCHEMADRUGCAUS T " +
" ON A.FLDREASON = T.FLDCODE " +
" WHERE A.FLDEMPLOYEE = ? " +
" ORDER BY A.FLDDATE DESC"
);
queryParms.add(new Long(empRec));
  1. Can i use HashSet instead of ArrayList above and does it make any sense in terms of performance?.

  2. What does the query do, do we need to append the query in StringBuffer. Why can’t i directly add to ArrayList?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:40:15+00:00Added an answer on May 17, 2026 at 1:40 am

    In general, you would want to use an ArrayList for query parameters – because the order matters. When you’ve only got a single parameter (as you have here) it’s not an issue – but I’d definitely use a list for consistency.

    As for using StringBuffer – you haven’t shown what you’re doing with sql here. If you’re not appending anything else, you could use a simple String… but you wouldn’t be adding it to the ArrayList, as it’s the query itself, not a query parameter.

    Finally, I’d recommend using generics, e.g.

    ArrayList<Long> queryParameters = new ArrayList<Long>();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ArrayList of HashMap like this: ArrayList<HashMap<String, String>> playListSongs = new ArrayList<HashMap<String,
I have a Arraylist List<?> myList=new ArrayList(); myList = fetchQuery(); //fetches the list of
This is the code ArrayList<MyObject> list = new ArrayList<MyObject>(); list.add(new MyObject()); Intent intent =
ArrayList<String> veri1 = new ArrayList<String>(); String[] veri2 = {Fatih, Ferhat, Furkan}; How can I
i have this code: ArrayList list = new ArrayList(); foreach (DataRow dataR in prenume.Rows)
ArrayList<yellowPage> ob1 = new ArrayList<yellowPage>(); yellowPage thing = new yellowPage(100,100); thing.calc(i,y,s3); ob1.add(thing); I stored
ArrayList<Integer> arrI = new ArrayList<Integer>(); ArrayList arrO = arrI; // Warning /* It is
Private _clientTCPList As ArrayList = ArrayList.Synchronized(New ArrayList()) ' get tcp client Dim clientTCP As
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair( product_name, product_name)); nameValuePairs.add(new BasicNameValuePair(brand, brand_product)); nameValuePairs.add(new BasicNameValuePair(reference_price,
ArrayList <String> cdcollection = new ArrayList(); private void initButtonActionPerformed(java.awt.event.ActionEvent evt) { Collections.addAll(cdcollection, small, mayre,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.