0

We have had some bugs caused by a misunderstanding of HashSet functionality. Apparently someone assumed that calling .iterator() would return the elements in the order they were inserted. What should have been used is LinkedHashSet.

Now, I was wondering if there is some way to search for this bug. As in: is there a way to find instances of iterator being called on variables of types implementing the Set interface?

trevore
  • 425
  • 2
  • 10
  • The answer to [Eclipse Find in Project](http://stackoverflow.com/questions/3175035/eclipse-find-in-project) Should shed some light on the issue. – CalebB Feb 24 '15 at 17:36
  • That was not my question at all. I want a search for any call to iterator() on a variable only of **type** Set. That is not just a text search. – trevore Feb 24 '15 at 22:28
  • On the contrary if you look at the answers to the question, there is a field: "search for", under the java search tab, with which you can specify method which I assume ".iterator()" is. – CalebB Feb 24 '15 at 22:32
  • That is true, but .iterator() can also be called on for example List instances. – trevore Feb 25 '15 at 13:47
  • It's not being limited by what type it's called on. If you read the answers you'll see it's searching for instances of "that method" not specific to type it's being called off of. – CalebB Feb 25 '15 at 14:25

1 Answers1

0

mark the iterator()-call and press Ctrl+Alt+h, the call-hierarchy will be shown; another way to do so is to right-click on the iterator()-call and choose "open call hierarchy".

BUT: the method is defined in the Set<E>-interface. so, all locations in workspace, where the method is called, are shown.