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

So I have always wanted to do something like this, but never knew how
So I wanted to have something like in this image . Basically you have
I have wanted to try GAE since launch, but coming from ASP .NET and
I currently have this and it works fine but I wanted to have a
I am programming in Ruby and have wanted to learn about matrices but I
For example I can have something like so, A B ba bb C Ca
Lets say I have something like: public class Item { public string Code; public
when i have a link like this which can be longer but i've put
I have something like this : <div style=width:1300px> <ul class=ul-length ul-textalign> <li class=li-horizontal> A
I want to make a helper macro for writing match-extensions. I have something like

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.