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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:31:42+00:00 2026-06-18T04:31:42+00:00

Hello I want to Fill Up my Arraylist of Arraylist named as QuestionIdList_Section and

  • 0

Hello I want to Fill Up my Arraylist of Arraylist named as QuestionIdList_Section
and for that i have make the temp Arraylist named QUESTION_ID_Of_SectionId_Temp that will be clear after adding into QuestionIdList_Section

My Code is as Below so that you can understand how i have codded :

public static ArrayList<String> QUESTION_ID_Of_SectionId_Temp = new ArrayList<String>();
public static ArrayList<ArrayList<String>> QuestionIdList_Section = new ArrayList<ArrayList<String>>();

QUESTION_ID_Of_SectionId_Temp.add("Hello");
QUESTION_ID_Of_SectionId_Temp.add("Hiii");

QuestionIdList_Section.add(0,QUESTION_ID_Of_SectionId_Temp);

Log.i(TAG, "******Before " + QuestionIdList_Section);
Log.i(TAG, "******Before "+ QUESTION_ID_Of_SectionId_Temp);

QUESTION_ID_Of_SectionId_Temp.clear();

Log.i(TAG, "******After  " + QuestionIdList_Section);
Log.i(TAG, "******After " + QUESTION_ID_Of_SectionId_Temp);

After Executing the Code i am getting Different Result for both Variable.

as Below :

******Before [[Hello, Hiiii]]
******Before [Hello, Hiiii]
******After [[]]
******After []

can some one Please Help me to Understand where i am lacking here. i want to clear temp arraylist so that i can put the different Values for UESTION_ID_Of_SectionId_Temp so for second index of QuestionIdList_Section i will set the Value different.

Thanks in Advance.

  • 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-18T04:31:43+00:00Added an answer on June 18, 2026 at 4:31 am

    QUESTION_ID_Of_SectionId_Temp is just a reference.

    So if you clear it, the value in QuestionIdList_Section will also be clear.

    What you should do is

    QUESTION_ID_Of_SectionId_Temp = new ArrayList<String>();

    instead of

    QUESTION_ID_Of_SectionId_Temp.clear();

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

Sidebar

Related Questions

Hello i want to make a site that will have a registration page a
Hello I want to fill an hashmap with value => key :idissue value:arraylist (list
hello everyone i have multiple dynamic edittext box.i want to give width to fill
I have: %{ lorem ipsum dolor sit %{hello world}% amet}% I want: hello world
I have a onclick function like this onclick = function(){alert('hello')} I want to add
Hello I want to draw the logo of Chelsea Football Club and I have
Hello I want to make one application in which i am using Absolute layout
hello i have question in Python subprocess module I want to interaction with child
Hello all i want to make my DrawingSurface view transparent. i tried many thing
Hello I want to make an application which uses Multi-touch support. for multitouch i

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.