Hello guys, I'm here with a new code I'm trying to make that I cannot get it out of my head :rage: So, here's my problem: I have two tables with information. Both of them have the same structure (ID, Value) but one of them has more repeated values than the other one. For example: |----------------------| |----------------------|
| ID Val | | ID Val |
|----------------------| |----------------------|
| 1 0 | | 1 0 |
| 1 0 | | 1 0 |
| 2 5 | | 1 0 |
| 2 5 | | 1 0 |
| 2 5 | | 2 5 |
| 2 5 | | 2 5 |
| 3 1 | | 2 5 |
| 3 1 | | 2 5 |
----------------------- | 3 1 |
| 3 1 |
------------------------
Here you can see two tables with the same structure but one of them has more repeated values than the other one (as I said before). What I'm trying to make, is the following: take the ID from the first table (ID = 1) and copy the value from the second table (Val = 0), but just copy it as many times as the ID in the first table exists. For example: if the ID 1 in the first table exists 2 times, copy the Val from the second table 2 times, skip the other two, and go to the next ID by doing the same.
I've tried to do it. The class I've made loads both tables and fills two ArrayLists with its information by putting them into an IntIntHolder class (thks aCis) in order to compare them later. So far, this is the code I've written, but it throws NoSuchElementException. And running it without the (see below), it prints some data but not all (if total data is 8, it prints 4).
while (elementA.getId() != elementB.getId())
Here's my code:
public void compareAndPrint()
{
Iterator<IntIntHolder> iterA = listA.iterator();
Iterator<IntIntHolder> iterB = listB.iterator();
while (listA.hasNext())
{
IntIntHolder elementA = iterA.next();
IntIntHolder elementB = iterB.next();
if (elementA.getId() == elementB.getId())
System.out.println(elementB.getValue());
else
{
while (elementA.getId() != elementB.getId())
iterB.next();
}
}
}
So ye... that's all. I'm trying to parse some data from the system so that's why I'm trying to do this.
Thanks for reading, and I'm looking forward to your answers!
L2 Insignia High Five 20x
MID SERVER FOCUSED ON
OLYMPIAD | PVP | AUTOFARM
OPEN BETA TEST SERVER
3 MAY 2024
GRAND OPENING
10 MAY 2024
Rates:
📜 XP/SP 20x | Spoil 15x | Drop 10x | Adena 10x 📜
Server Features:
🔥 No Olf-T Shirt, No big over-enchant, No over-power Donate 🔥
🔥 VIP Gold Color Chat, Unique Olympiad Extra Points Engine, GvG Event 🔥
🔥 Auto-Farm, LoA and DV scheduled PvP Zone, Calendar Daily Reward 🔥
🔥 Castle Instance, Solo Instance, PvP Solo Rift, Dress me system, Adena Boxes 🔥
Website:
https://www.l2insignia.com
Discord:
https://discord.com/invite/yEgsrHn2hQ
I am selling the essence project which includes versions 388 and 439 that have been running for over 2 years or (447 as custom PVP like Pride). I have a test server for you to test them out. If you are really interested in it then contact my seller at discord: kiwi7106.
Price: 4000 Euro
P/s: This is a project that I have spent a lot of money and time developing, so if you are not interested in it, please get out of this topic, thank you.
P/s 2: If you find the price too expensive, it's best to skip this article and find another project and don't comment negatively on my topic, thank you.
Someone ask me for this, it should work on any client that has Kamael race, preview:
Installation - there are two ways to install depending on how you want to use it:
Method 1: If you want to completely replace the original, do:
Copy all lines from your armorgrp to Notepad++, press Ctrl+H, check the "match whole word" option and replace:
kamael.Mkamael_m000_w_ad00
by:
AvengersKamaelWings.Avengers_MKamael_m001_w_ad00
Then replace:
MKamael.Mkamael_m000_t00_w
by:
AvengersKamaelWings.MKamael_m001_t00_w
Now repeat the same process with the female, replace:
kamael.Fkamael_m000_w_ad00
by:
AvengersKamaelWings.Avengers_FKamael_m001_w_ad00
Then replace:
FKamael.Fkamael_m000_t00_w
by:
AvengersKamaelWings.FKamael_m001_t00_w
You're done, paste everything back into File Edit and save!
Method 2: If you only want to replace in specific sets, execute the above process only on the armorgrp of those sets.
Repack by: AvengersTeamBr
Password: LadrãoDeFrango
Question
Alianza
Hello guys,
I'm here with a new code I'm trying to make that I cannot get it out of my head :rage:
So, here's my problem: I have two tables with information. Both of them have the same structure (ID, Value) but one of them has more repeated values than the other one. For example:
|----------------------| |----------------------|
| ID Val | | ID Val |
|----------------------| |----------------------|
| 1 0 | | 1 0 |
| 1 0 | | 1 0 |
| 2 5 | | 1 0 |
| 2 5 | | 1 0 |
| 2 5 | | 2 5 |
| 2 5 | | 2 5 |
| 3 1 | | 2 5 |
| 3 1 | | 2 5 |
----------------------- | 3 1 |
| 3 1 |
------------------------
Here you can see two tables with the same structure but one of them has more repeated values than the other one (as I said before). What I'm trying to make, is the following: take the ID from the first table (ID = 1) and copy the value from the second table (Val = 0), but just copy it as many times as the ID in the first table exists. For example: if the ID 1 in the first table exists 2 times, copy the Val from the second table 2 times, skip the other two, and go to the next ID by doing the same.
I've tried to do it. The class I've made loads both tables and fills two ArrayLists with its information by putting them into an IntIntHolder class (thks aCis) in order to compare them later. So far, this is the code I've written, but it throws NoSuchElementException. And running it without the (see below), it prints some data but not all (if total data is 8, it prints 4).
Here's my code:
So ye... that's all. I'm trying to parse some data from the system so that's why I'm trying to do this.
Thanks for reading, and I'm looking forward to your answers!
Link to comment
Share on other sites
7 answers to this question
Recommended Posts