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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:20:58+00:00 2026-06-18T04:20:58+00:00

I have an ArrayList that is not vary memory intensive, it stores only two

  • 0

I have an ArrayList that is not vary memory intensive, it stores only two fields,

 public class ExampleObject{

 private String string;
 private Integer integer;

 public ExampleObject(String stringInbound, Integer integerInbound){
 string = stringInbound;
 integer = integerInbound;
 }

I will fill an ArrayList with this objects

  ArrayList<ExampleObject> = new ArrayList<ExampleObject>();

for raw, hard core performance is it much better to use a hashset for this? If my ArrayList grows to a vary large number of items with an index in the the hundreds, will I notice a huge deference between the ArrayList of Objects and the hashset?

  • 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-18T04:20:59+00:00Added an answer on June 18, 2026 at 4:20 am

    It all depends on what you’re doing. How is data added? How is it accessed? How often is it removed?

    For example, in some situations it might even be better to have parallel arrays of String[] and int[] — you avoid collection class overhead and the boxing of int to Integer. Depending on exactly what you’re doing, that might be really great or incredibly dumb.

    Memory consumption can have a strong effect on performance as data sets get larger. A couple of IBM researchers did a neat presentation on Building Memory-efficient Java Applications a few years back that everyone who is concerned about performance should read.

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

Sidebar

Related Questions

I have a two dimensional ArrayList that I need to filter the duplicates out
I have a two-dimension ArrayList that contains double values: ArrayList<ArrayList<Double>> data = new ArrayList<ArrayList<Double>>();
I have two ArrayList's that I am using, one for the enemy sprites and
Imagine I have this: public class Animal { private String racaAnimal; private String corAnimal;
I have an ArrayList which stores a custom object. I want to serialize that
So I have an ArrayList of objects of my own class: public class A
I have an arraylist arrTotalItems of class Operation.Operation . the class has two properties
I have a two dimensional ArrayList that is being populated with string values in
I have an ArrayList<MyObject> that may (or may not) contain duplicates of MyObject I
I have an arraylist that gets different type of values in it, 1st value->

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.