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

  • Home
  • SEARCH
  • 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 8643587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:05:07+00:00 2026-06-12T12:05:07+00:00

I have one Array List and contains some values like 2,3,4,5,6. now how to

  • 0

I have one Array List and contains some values like 2,3,4,5,6. now how to check if the value is present and want to delete that particular Value. please help me to do this. tnx in advance.

I tried ,

ArrayList<Integer> Positions=new ArrayList<Integer>();
Positions.remove(6);

but it shows an error.

  • 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-12T12:05:09+00:00Added an answer on June 12, 2026 at 12:05 pm

    Positions.remove(6); delete the item from particular position.

    So first you have to compare the item in arraylist using for loop and get the position of that item and call Positions.remove(that Item Position in ArrayList).

    Try this code.

    ArrayList<Integer> positions = new ArrayList<Integer>();
    positions.add(3); // add some sample values
    positions.add(6); // add some sample values
    positions.add(1); // add some sample values
    positions.add(2); // add some sample values
    positions.add(6);
    
    for(int i=0;i<positions.size();i++)
    {
        if(positions.get(i) == 6)
        {
            positions.remove(i);
        }
    }
    
    Log.i("========== After Remove ",":: "+positions.toString());
    

    Output : I/========== After Remove ( 309): :: [3, 1, 2]

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

Sidebar

Related Questions

I have one array. I want that array to retain its value between function
I have one array that is filled by mysql_query. Values that are in this
I have two different arrays. One array, a, for a list of people. My
I want to implement singleten design pattern in iphone code I have one array.
I have an array List<SomeObject> which contain ascending order of dates (and some more
I have some data structures, and I would like to use one as a
I have a Numpy array and a list of indices whose values I would
I have a List of objects which contain a string array as one of
I have a List with some tables from a database where each row contains
I have arraylist myorderdata . I want to retrieve this arraylist to one String

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.