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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:56:49+00:00 2026-06-18T05:56:49+00:00

how do I compare two arraylists? I have a sdCoverList array and thumbnailList array.

  • 0

how do I compare two arraylists?

I have a sdCoverList array and thumbnailList array.

02-04 11:05:05.210: I/System.out(4035): HASHED THUMBNAIL[-2122410790, 2043473787, 1914391068, 1785308349, 1656225630, 1527142911, 1398060192, 1268977473, 1139894754, 1010812035, 1242943301, 1113860582, 984777863, 855695144, 726612425, 597529706, 468446987, 339364268, 210281549]
02-04 11:05:05.210: I/System.out(4035): SD COVER LIST[-2122410790, 2043473787, 1914391068, 1785308349, 1268977473, 1656225630, 1527142911, 1139894754, 1398060192, 1010812035, 1242943301, 1113860582, 984777863, 855695144, 726612425, 597529706, 468446987, 339364268, 210281549, 717409028]

In my sd cover list, i have an extra value that i want to remove away but first i’d have to compare with thumbnailList array first. if both have the same elements, don’t do anything but if theres an extra, remove it from sd card.

My array lists

for sdCoverList:

// CHECK DIRECTORY BEFORE DELETING THEM
            File strPath = new File(Environment.getExternalStorageDirectory() + folderName+"/Covers");
            File yourDir = new File(strPath, "");
            if(yourDir.length()!=0)
            for (File f : yourDir.listFiles()) {
                if (f.isFile())
                {
                    String name = f.getName();
                    sdCoverList.add(name);
                    //System.out.println(sdCoverList);
                }

for hashedthumbnail

for (int a=0;a<=thumbnailList.size()-1;a++)
        {
            String hashed = String.valueOf(thumbnailList.get(a).hashCode());
            Log.d("hashed",hashed);
            hashedThumbnail.add(hashed);
        }
  • 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-18T05:56:50+00:00Added an answer on June 18, 2026 at 5:56 am
    List<String> sdCoverList = new ArrayList<String>();
    sdCoverList.add("-2122410790");
    sdCoverList.add("2043473787");
    sdCoverList.add("717409028");
    
    List<String> hashedThumbnail = new ArrayList<String>();
    hashedThumbnail.add("-2122410790");
    hashedThumbnail.add("2043473787");
    
    System.out.println("sdCover List: " + sdCoverList);
    System.out.println("hashedThumbnail List: " + hashedThumbnail);
    
    
    List<String> temp = new ArrayList<String>();
    temp.addAll(sdCoverList);
    temp.removeAll(hashedThumbnail);
    
    System.out.println("temp List: " + temp);
    
    sdCoverList.removeAll(temp);
    
    System.out.println("sdCover List: " + sdCoverList);
    

    The output will be

    sdCover List: [-2122410790, 2043473787, 717409028]
    hashedThumbnail List: [-2122410790, 2043473787]
    temp List: [717409028]
    sdCover List: [-2122410790, 2043473787]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to compare two arraylist? I have two String ArrayLists of different
I am trying to compare two tools execution time, which I have installed in
I have two arrays (or arraylists if it is easier) of strings. I need
I have two arraylists, one contains Strings and the other contains Classes that have
I have two arraylists: a1 = {1, 0, 0, 1, 0, 0,} and a2
I have two array list. Each has list of Objects of type User. The
I have two sorted arrays (can be ArrayLists, Collections, or any other data format)
I have two ArrayLists. ArrayList A contains: ['2009-05-18','2009-05-19','2009-05-21'] ArrayList B contains: ['2009-05-18','2009-05-18','2009-05-19','2009-05-19','2009-05-20','2009-05-21','2009-05-21','2009-05-22'] I have
I have two ArrayList s of type Answer (self-made class). I'd like to compare
I have two ArrayList . Each is of size 100000. I want to compare

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.