Hi
When working on my project, I am needing to split an array into a hashmap where the index is used to access a smaller array of objects. Any ideas / thoughts would be helpful
CopyableCougar4
Hi
When working on my project, I am needing to split an array into a hashmap where the index is used to access a smaller array of objects. Any ideas / thoughts would be helpful
CopyableCougar4
Just wondering why exactly do you need this?
In my project the user has a list of upgrades they can use and I want to have a page system to display them. However, I am open to simpler solutions if you have any
CopyableCougar4
Once again I solved my problem I should really stop posting and just stop and think
CopyableCougar4
For anybody interested, this is my solution (ignore the variables I haven’t explained, however a lot of them should be easy to figure out). I just only iterate through part of the list.
int col = 1, row = 1;
for(int active = ((currentPage - 1) * columns * rows);
active < (Math.min(upgrades.size(), (((currentPage - 1) * columns * rows) + (columns * rows)))); active++){
Upgrade upgrade = upgrades.get(active);
if(col == columns){
row++;
col = 1;
}
//System.out.println(upgrade.getName());
upgrade.getIcon().draw(x + ((col) * gapDimension), 50.0f + ((row) * gapDimension), upgrade.getIcon().getScale(imageDimension));
col++;
}
My thought process before posting a question:
Hi
Heh I just do:
CopyableCougar4
Mine is;
That’s why you write your algorithms to crowd-source themselves!
http://gkoberger.github.io/stacksort/
:persecutioncomplex:
Heh, I do:
-Google
-Scratch my head
-Draw pictures of the problem
-Start making a new thread on JGO
-Solve the problem while typing it out
-Profit!