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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:18:30+00:00 2026-06-15T23:18:30+00:00

I’m using Android 2.3.3. I have a mainArrayList<String> , and a subArrayList<String> which has

  • 0

I’m using Android 2.3.3. I have a mainArrayList<String>, and a subArrayList<String> which has content that is part of mainArrayList<String>. I wish to remove this subArrayList<String> from the mainArrayList<String>.

How do I do it?

I tried using alMainArrayList.remove(alSubArrayList). But it doesn’t work. Can someone help me?

Ex:

alMainArrayList<String> = [1,+,(,2,*,(,3,+,4,),),)]
alSubArrayList<String> = [(,3,+,4,)]

For more information, I am developing a calculator app, where in i have the given expression in a ArrayList<String> alMainArrayList. After performing the evaluation of a sub expression, I wish to remove it from the alMainArrayList and then insert the result into it at the specified index. The code complies.

The problem is, the subexpression, which i have in alSubArrayList doesn’t get deleted, when i use alMainArrayList.remove(alSubArrayList) or even alMainArrayList.removeAll(alSubArrayList).

It’s a loop, and so the result gets added at the specified index (without first deleting the subArrayList) and the loop enters into infinite loop.

To provide the code snippet, it’s a bit hard. They are bits of pieces here and there. So, if someone understood what i wanted to say, please help me.

  • 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-15T23:18:31+00:00Added an answer on June 15, 2026 at 11:18 pm

    I have found a method subList() for the ArrayList.

    Here is the information as per the help, when you place it on the method.

    subList() :::: for an ArrayList

    Returns a part of consecutive elements of this list as a view. The returned view will be of zero length if start equals end. Any change that occurs in the returned subList will be reflected to the original list, and vice-versa. All the supported optional operations by the original list will also be supported by this subList.

    This method can be used as a handy method to do some operations on a sub range of the original list, for example list.subList(from, to).clear();

    If the original list is modified in other ways than through the returned subList, the behavior of the returned subList becomes undefined.

    The returned subList is a subclass of AbstractList. The subclass stores offset, size of itself, and modCount of the original list. If the original list implements RandomAccess interface, the returned subList also implements RandomAccess interface.

    The subList’s set(int, Object), get(int), add(int, Object), remove(int), addAll(int, Collection) and removeRange(int, int) methods first check the bounds, adjust offsets and then call the corresponding methods of the original AbstractList. addAll(Collection c) method of the returned subList calls the original addAll(offset + size, c).

    The listIterator(int) method of the subList wraps the original list iterator. The iterator() method of the subList invokes the original listIterator() method, and the size() method merely returns the size of the subList.

    All methods will throw a ConcurrentModificationException if the modCount of the original list is not equal to the expected value.

    Parameters
    start start index of the subList (inclusive).
    end end index of the subList, (exclusive).

    Returns
    a subList view of this list starting from start (inclusive), and ending with end (exclusive)
    Throws
    IndexOutOfBoundsException if (start < 0 || end > size())
    IllegalArgumentException if (start > end)

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have an array which has BIG numbers and small numbers in it. I
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.