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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:27:49+00:00 2026-05-30T23:27:49+00:00

I am trying to create a multidimensional arraylist. but it is not adding this

  • 0

I am trying to create a multidimensional arraylist. but it is not adding this is my code

here is the initialization

     public class BinList {

private ArrayList<Garbage> GarbageList;
private int[] PenaltyArray = new int[10];
private ArrayList BoostList;

this is the constructor

public BinList() {
    BoostList = new ArrayList<Integer>();
}

this is the method, this method takes two parameters the first is the file path and the second is a loop from 1 to 10. so i read the file and send the information of each line with the loop number to another method to create the arraylist (ArrayList) and it works fine so when this method is done and all the file is read i insert the arraylist(ArrayList) into the arraylist(ArrayList BoostList) but there is no new values in this arraylist. am i doing something wrong here? if anymore code is needed please tell me

     public void ReadLine(String filePath, int Container) {
    try {
        File file = new File(filePath);
        Scanner scan = new Scanner(file);
        GarbageList = new ArrayList<Garbage>();
        while (scan.hasNextLine()) {
            String readLine = scan.nextLine();

            if (readLine != null) {

                getSplitLinesOrders(readLine, Container);
            }
        }

        ((ArrayList) BoostList.get(Container)).add(GarbageList);


    } catch (Exception e) {
    }
} 
  • 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-05-30T23:27:51+00:00Added an answer on May 30, 2026 at 11:27 pm

    You are trying to get an ArrayList from BoostList:

    ((ArrayList) BoostList.get(Container)).add(GarbageList);
    

    but you never add anything to BoostList, so this will always fail.

    You catch Exceptions but swallow them silently (you don’t print an error) so this problem is hidden.

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

Sidebar

Related Questions

I'm trying to use the code below to create a multidimensional ArrayList. My code
I am trying to initialize a multidimensional array. Here is my syntax; this does
I have been trying to code this for a while but I am so
Basically I'm trying to create an implementation of simulated annealing for the multidimensional knapsack
I am trying to create a multi dimensional array using this syntax: $x[1] =
Ok so I am trying create a login script, here I am using PHP5
Trying to create a user account in a test. But getting a Object reference
I'm trying to create a multidimensional array from a string (received from $_GET, input
I am trying to create Jqplot bar charts and facing difficulty in creating multidimensional
I am trying to create a PDO class and I get the error: PHP

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.