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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:04:42+00:00 2026-06-05T10:04:42+00:00

I want to display all elements in an ArrayList , except element 10 (which

  • 0

I want to display all elements in an ArrayList, except element 10 (which is the word “will”). How do I do this? When I run the below code it shows nothing.

 private void practiceButtonActionPerformed(java.awt.event.ActionEvent evt) {
     ArrayList <String> practice1 = new ArrayList();
     Collections.addAll(practice1, "If", "she", "boarded", "the", "flight"
                        , "yesterday", "at",  "10:00,", "she", "will", "be"
                        , "here", "anytime", "now.");
     contentTextPane.setText(practice1.get(0+1+2+3+4+5+6+7+8+9+11+12+13));
 }
  • 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-05T10:04:44+00:00Added an answer on June 5, 2026 at 10:04 am

    The line

    practice1.get(0+1+2+3+4+5+6+7+8+9+11+12+13)
    

    Does not do what you think it does. This will compute the value of 0 + 1 + 2 + … + 13, then look up that entry in the ArrayList. Since your ArrayList doesn’t have this many elements, it will throw an IndexOutOfRange exception.

    If you want to display everything except the tenth element, try using a loop:

    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < practice1.size(); i++) {
        if (i != 10) {
            builder += practice1.get(i);
        }
    }
    contextTextPane.setText(builder.toString());
    

    Hope this helps!

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

Sidebar

Related Questions

I have db with this table (TableToDo): http://goo.gl/NlTEk I want display all records in
I have a following code , I want to display all the attributes of
I want to modify this code which works pretty good but (or I don't
I want to display a children element of my html page all over the
I am writing a custom validation set that will display all missing elements on
What I want: Within $myElement find all elements with class .myClass and attribute display:none
I want to display all elements from a ListBox to a TextBox. I'm not
This is related to the post display all elements in a nested cell array
I want to display all the possible enum values as Radio buttons. I am
I want to display all records from table of current autorized user in my

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.