Originally posted by Mike Curwen:
Anyone?
I can't believe it wouldn't be useful. As TreeSet (or HashSet) currently stands, the only way to retrieve a single item from the Set is to iterate over all of them, using equals() to see if you have the 'right one'.
Maybe I'm using the wrong Collection object.
* I want a 'bag' of items.
* When I iterate over them, I want to iterate in the order they were inserted.
* Each object the 'bag' contains has it's own identifying 'number', so the containing bag's idea of what index its stored under does not matter.
* i should be able to remove() an item, based on its identifying 'number'.
* size() should return the number of items in the bag, and not the number of spaces (empty or not) in the bag
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
"I'm not back." - Bill Harding, Twister
Willie Smits increased rainfall 25% in three years by planting trees. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|