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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:26:10+00:00 2026-06-03T22:26:10+00:00

I want to do exactly like this in java Compare two string ArrayLists the

  • 0

I want to do exactly like this in java

Compare two string ArrayLists

the accepted answer is perfect.. ‘Except’ method… is there a equivalent of this in Java …
sure there isn’t in standard Java lib, but is there something in third party libs like apache ?

P.S I googled this .. coudn’t find anything

  • 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-06-03T22:26:12+00:00Added an answer on June 3, 2026 at 10:26 pm

    You want to find the elements of list a that are not present in list b.

    How about:

    a.removeAll(b);
    

    That will remove all elements of b from a. Whatever’s left in a is by definition something that wasn’t in b.

    If you can’t or don’t want to change a, copy it and do the removeAll() on the copy.

    And more generally, if your collection class in Java doesn’t support removeAll(), then create a collection type that does support it from a and do the remove on that new object.

    If the lists are large, you’ll probably want to create a HashSet from a for example, so the removals (i.e. the internal lookup part of doing a removal) can happen more efficiently than for a List subtype.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want my widget to look exactly like it does now, except to be
I want to do exactly like the above image via code (android). But I'm
I want to create span exactly like an input textbox , but inside the
I want to use boost::crc so that it works exactly like PHP's crc32() function.
I'm trying to do something like this, but Java won't let me. I suspect
I have a URI string like the following: http://www.christlichepartei%F6sterreichs.at/steiermark/ I'm creating a java.lang.URI instance
There is a client who would like to install a custom Java application on
first I'm gonna try to explain what exactly I want to do: I have
I'm trying to parse phone number with regex. Exactly I want to get a
I want to take data from a table that'll be almost exactly similiar to

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.