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 7499185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:44:15+00:00 2026-05-29T19:44:15+00:00

hi am storing the results in array list which are obtained by querying different

  • 0

hi am storing the results in array list which are obtained by querying different database in java. i need to compare this array list to get the common rows

      List name = new  ArrayList();
      name.add(Spreadsheets.getString("Name"));

     List namedb = new  ArrayList();
     namedb .add(rs.getString("eName"))

in c++ we use strcmp to compare. but in java how do i compare this arraylist and it should return common rows. or how do i apply binary search algorithm to search these 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-29T19:44:16+00:00Added an answer on May 29, 2026 at 7:44 pm

    Use the List’s retainAll method.

    List<String> names = new ArrayList<String>();
    List<String> namesDB =  new ArrayList<String>();
    
    // Get some names ??
    names.add(Spreadsheets.getString("Name"));
    
    boolean hasCommonNames =  namesDB.retainAll( names );
    
    // The namesDB will only contain the common names.
    if( hasCommonNames ) {
        // Do something with the common names
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build up a string array in JavaScript and get the results
I've got a problem with a web service which has an array or List
I have this method which return an array of string : private static string[]
I simply need to add floatArray1 to floatArray2 storing the result in floatArray2.. no
I tried the following code in LINQPad and got the results given below: List<string>
I would like to sort a list of strings which represent paths. The sort
So, I have a list containing a custom class, MyClass MyClass has properties, which
I'm creating an array of BackgroundWorker that shares one event handler like this: BackgroundWorker[]
I have a search script which logs every search query in a MySQL database
ArrayList<String> emplist = new ArrayList<String>(); //Inside the array I add list of employee that

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.