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

  • Home
  • SEARCH
  • 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 6704219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:15:49+00:00 2026-05-26T07:15:49+00:00

I am attempting to recreate a board game in Java which involves me storing

  • 0

I am attempting to recreate a board game in Java which involves me storing a set of valid places pieces can be placed (for the AI). I thought that perhaps instead of storing as a list of Points, it would be run-time faster if I had an array/list/dictionary of the X coordinates in which there was an array/list of the y coordinates, so once you found the x coordinate you would only have to check its Ys not all the remaining points’.

The trouble I have is that i must change the valid points often. I came up with some possible solutions but have difficulty picking/implementing them:

  • HashMap < Integer, ArrayList > with X as an integer key and the Ys as an ArrayList.
    • Problem: I would have to create a new ArrayList every time I add an X.
    • Also I am unsure about runtime performance of HashMap.
  • int[X][Y] array initialized to the board size with each point set to its relative location (point 2,3 sets[2][3]) unset point being an invalid integer.
    • Problem: I would have to iterate through all the points and check every point.
  • List of Points This would simply be a Linked/Array List of Points.
    • Problem: Lists are slower than arrays.
    • How would using a Linked list of Points compare to checking the whole array like above?

Perhaps I should use a 2d linked list? What would be the fastest runtime way to do 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-26T07:15:50+00:00Added an answer on May 26, 2026 at 7:15 am

    You’re worrying about the wrong things. Accessing collection/map/array items is extremely fast. The graphical part will be way more performance-sensitive. Just use whatever data structure is most natural. It’s unlikely that you’re going to be storing enough items to really matter anyway. Build it first, then figure out where your performance problems really are.

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

Sidebar

Related Questions

I'm attempting to recreate a time sheet built on asp and I can't figure
I am attempting to drop and recreate a database from my CI setup. But
Attempting to set up Samba + OpenLDAP using nss_ldap. After joining Windows7 to Samba
Attempting to follow this Java tutorial . About 63 pages in, you are instructed
Attempting to set the tabIndex for date_select has proven to be difficult out of
Attempting something like public string MyText { get {return lbl.Text;} set {lbl.Text = value;}}
I am attempting to recreate an effect that I found on ( another site
In trying to understand javascript best practices, I'm attempting to recreate a piece of
Attempting to insert an escape character into a table results in a warning. For
Attempting to print out a list of values from 2 different variables that are

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.