I need to store a number of objects in a Set. Sometimes I want to iterate over everything in the Set, and sometimes I’d like to iterate over only that implement a particular interface. Some objects will implement several of the interfaces that I want a view on.
Is there a design pattern or Guava/Java class that allows views-by-type on a Set or other collection? Preferably in the most efficient manner possible, as this code will be central to a core game loop getting called every 17 milliseconds.
With Guava —