wvxvw
12-23-2009, 11:28 AM
I need a collection with numeric indices which update when item is removed or added, the items in a collection must be unique, there shouldn't be empty indices, performance and ease of implementation also matter, however, are less important.
So far I tried:
TypedDictionary<MyType, UInt>
- I need to add functionality for updating the indices.
Array<MyType>, List<MyType>
- I need to add functionality to prevent empty indices and repetitive entries.
haxe.FastList<MyType>
- Easier to check for repetitions, however, creates a new class per each type of values.
Hash<MyType> isn't really an option since it uses strings for indices. Though IntHash<MyType> could be an option, but it is almost the same as TypedDictionary.
Could be there are more collection types, and I just missed some?
What would you use in such case?
So far I tried:
TypedDictionary<MyType, UInt>
- I need to add functionality for updating the indices.
Array<MyType>, List<MyType>
- I need to add functionality to prevent empty indices and repetitive entries.
haxe.FastList<MyType>
- Easier to check for repetitions, however, creates a new class per each type of values.
Hash<MyType> isn't really an option since it uses strings for indices. Though IntHash<MyType> could be an option, but it is almost the same as TypedDictionary.
Could be there are more collection types, and I just missed some?
What would you use in such case?