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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:45:13+00:00 2026-05-26T21:45:13+00:00

I tried cache = new Vector<CacheBlock>(1024); … cache.add(10, blk); // gives index out of

  • 0

I tried

cache = new Vector<CacheBlock>(1024);
...
cache.add(10, blk); // gives index out of bounds

So is it impossible to insert (into specified index) into an empty list? Or how might I fill up all elements if the Vector, with null or otherwise, so I can accomplish this?

  • 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-26T21:45:14+00:00Added an answer on May 26, 2026 at 9:45 pm

    You could use setSize() to make sure your cache is big enough before you insert elements:

    setSize

    public void setSize(int newSize)

    Sets the size of this vector. If the new size is greater than the current size,
    new null items are added to the end of the vector. If
    the new size is less than the current size, all components at index
    newSize and greater are discarded.

    cache = new Vector<CacheBlock>(1024);
    cache.setSize(11);
    cache.add(10, blk);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a new Local Database Cache item in Visual Studio 2010
I'm using Spring 3.1 and I want to use the new cache features. Then,
If so how do I get a hold of the Cache object? I tried
I have uploaded a new favicon onto a Drupal site, cleared my cache, and
How to use 2nd Level Cache with NHibernate.Search ? I tried to enable SetCacheable
After installing a new build machine, I found out it came with 6.0.10 of
Is there any speed- and cache-efficient implementations of trie in C/C++? I know what
I've tried applying several suggestions found on the web, but still experiencing cached results
Tried to map it from Preferences -> Settings -> Keyboard, but the key combo
Tried something like this: HttpApplication app = s as HttpApplication; //s is sender of

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.