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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:58:55+00:00 2026-06-03T19:58:55+00:00

I want to load a series of objects to an ArrayList, and return the

  • 0

I want to load a series of objects to an ArrayList, and return the index of where it was added so it can be used later directly from the ArrayList. It’d be akin to me loading a set of 5 frames for a graphic and calling the data for frame 3 directly from the list.
Upon looking around at a couple potential posts that may be related, I found something that was related, and made me wonder. Is there even a built in function to GET the index of a recently added object?

The link I am looking at that made me think of this was: ArrayList indexOf() returns wrong index?

Basically, the way I was looking at it was that I would do something along the lines of the following psuedocode:

    private ArrayList<FrameData> mylistofframeshere = new ArrayList();
    FrameData Framenumberone = new FrameData(constructorblah goes in here);
    int wherediditgo = mylistofframeshere.add(Framenumberone);

Or I thought I could do something along the lines of

    mylistofframeshere.getindex(Framenumberone);

My backgrounds in coding are more procedural based at this point, so I am more used to knowing what the index is, just in order to place the data to begin with. I looked around at the oracle documentation as well, with findings something similar to the above link. Any suggestions??

EDIT : I’m going to add some extra clarification in here, because I really didn’t put enough effort into the example and explanation.

Another example of trying to use something like a direct index of a list would be if I had a set of tiles I wanted to use as terrain for a game or something. I would load a set of possible tiles for the area into a central ArrayList. Upon trying to place these tiles, I would just reference the pre-loaded object I have in my ArrayList in order to draw the appropriate bitmap/whatever.

I’m still a bit new to Java, so I’m willing to bet it’s just something simple I’m overlooking in the mechanics of using these datatypes. I’ll keep editing this until I get the explanation right.

  • 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-03T19:58:56+00:00Added an answer on June 3, 2026 at 7:58 pm

    When you add something to an ArrayList, it goes to the last available space. In other words:

    List<FrameData> list = new ArrayList<FrameData>();
    list.add(frame1);
    
    FrameData frame = list.get(list.size() - 1); //frame == frame1
    

    But I wonder why you would need to do that. If you explain more about what you are trying to achieve, there might be a different / better way to get to the same result.

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

Sidebar

Related Questions

I want to load a static text file from an HTML document without using
I want to load 52 images (deck of cards) in gif format from my
I want to load some images into my application from the file system. There's
I want to load some data from mysql into my cocoa application view before
I want to load XML from an external link using PHP, then pass the
How can I fire something on the last in a series of load events?
I am loading content from a series of links like this : <div id=tagList
at first sorry my bad English I want load model in my plugin controller
i want to load an array of page-specific external .js files. in the past,
I want to load a number of tiled layer and animates them. In iPhone

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.