I have an array (itemArray
) that contains a number of objects. Each of these objects, which we'll refer to as item
objects, has a property containing an item identifier that tells what type of item it is. We'll call that one IID
.
Now, the user is going to be using the application to add instances of item
to itemArray
, and the user may add several identical instances (for example, 4 item
s, each with an IID
of 3). Eventually, itemArray
is going to contain arguably hundreds of instances of item
, and those instances will be added in no particular order, and there could be several instances that are identical to other instances in the array (4 item
s with an IID
of 3, 2 item
s with an IID
of 6, etc etc).
I need to create an array (let's call it tempArray
) that will be able to give a summary of the objects in the array based on the IID
. I don't need to count the objects of each type in itemArray
, I just need to add 1 instance of item
to tempArray
for each type of item
in itemArray
.
So, for example:
If my itemArray
looks like this:
item.IID = 4
item.IID = 3
item.IID = 4
item.IID = 6
item.IID = 4
item.IID = 5
item.IID = 6
item.IID = 3`
Then I need tempArray
too look like this:
item.IID = 4
item.IID = 3
item.IID = 6
item.IID = 5
Where tempArray
just shows the variety of objects in itemArray
based on the IID
.
Thanks in advance!