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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:56:49+00:00 2026-05-18T01:56:49+00:00

hi when I wanted to have something like vector of vectors (elements shall be

  • 0

hi when I wanted to have something like vector of vectors (elements shall be ordered of course) I thought of having arraylist of arraylists but in C++ i would do this to access the element v.at(i).at(j)=5; and when i need to add new element v.at(i).push_back(value);
so how do i do this in java ? because I can only access the outer arraylist but i don’t know how to add new elements…and is there a better way to simulate C++ vector of vectors in java ??

p.s (it’s not a matrix 3*2 for ex but each arraylist may have different size)

  • 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-18T01:56:50+00:00Added an answer on May 18, 2026 at 1:56 am

    Declare an ArrayList of ArraList<Integer>s:

    ArrayList<ArrayList<Integer>> v = new ArrayList<ArrayList<Integer>>();
    v.add(new ArrayList<Integer>());
    
    v.get(0).add(new Integer(5));
    v.get(0).add(new Integer(10));
    System.out.println(v.get(0).get(0)); // => 5
    System.out.println(v.get(0).get(1)); // => 10
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been bitten by something unexpected recently. I wanted to make something like
At the moment I have something like this... SELECT SUM(a.PaidSingle) AS PaidSingle, DATE_FORMAT(a.TimeIn, '%a')
Say I wanted to have a project, and one-to-many with to-do items, and wanted
If I wanted to have Python distributed across multiple processors on multiple computers, what
Let's say I wanted to have an application that could easily switch the DB
Ruby is preinstalled on my Mac and so I wanted to have a look
I've been working on a project in Delphi 7 where I wanted to have
Iam a great fan of javascript frameworks especially jQuery .I have always wanted to
I have a quick little application and wanted to give a try to develop
I have a button which I wanted to flash briefly to get the user's

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.