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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:56:43+00:00 2026-06-14T01:56:43+00:00

I have created an object to store a lot of data. There are a

  • 0

I have created an object to store a lot of data.

There are a total of 15 different types of this objects, for which I need to store data with the following time frame:

8.00 9.00 10.00 11.00 12.00 //ect ect

an example of this would be: in between 8.00 – 9.00 the data of this type would be 15 and between 9.00 and 10.00 it would be 5.

Now when I want to calculate the average of these numbers I want to get the average of each time period so for example I wish to find the average of the data between 8.00 and 9.00

My question is not how to get the data, but instead how I would store the data in my object.

So far my object looks like this:

    public class CallQueue {

    private String type;
    private int data;

    public CallQueue(String type, int data){
        this.type = type;
        this.data = data;   
    }
    public void setType(String type){
        this.type = type;
    }
    public String getType(){
        return type;
    }
    public void setData(int data){
        this.data = data;
    }
    public int getData(){
        return data;
    }
}

My question to you is: What is the best way to store an Integer with a timestamp ? I’d prefer to avoid Hashmap or Hashtable since they are harder to loop through! Can I avoid this in some way and if, so how?

Update – More information

My goal is to use the following method (this is in my statistic class)

public void calculateAverage(double time){
        if (time != 20.00) {
        double data =0; 
        int times = 0;
        for (CallQueue cq : getData()) {
            data += cq.getData();
            times++;
        }       
        averageData.add(data/times);
        calculateAverage(time + 1);
        }
    }

as you can see I want to add the average of the data between 8 – 19.00 (with interval of 1 hour) all of these will be added to an arrayList (averageData)!

So the for each loop needs to get all the data from each object at the given time

  • 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-14T01:56:44+00:00Added an answer on June 14, 2026 at 1:56 am

    My question to you is: What is the best way to store an Integer with a timestamp ?

    I would say.

    Create a class with two members

    a integer
    a date

    That is the way I could think of. If there exists anything better. Not sure.

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

Sidebar

Related Questions

I have MySQL database, where I store the following BLOB (which contains JSON object)
Good day, I have created an object that will manage data access. My app
I'm hoping someone can help on this one, I have created a custom object
I have created an empty json object having an array itemlist(which further contains itemid
I have created some python code which creates an object in a loop, and
I have an ExpenseType object that I have created with the following migration: class
I make an application which has to store a lot of data in memory
I need some help to store some data efficiently. I have a large list
I have a lot of binary data on Core Data which I would like
I have created an object at runtime by using innerHTML tag, now I want

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.