I think the short answer is no, there's no obvious equivalent.
The boost multi-index class is very heavily templated, which isn't easily translatable in Java. There are generics, but they're not at all the same. ( http://stackoverflow.com/questions/996135/how-are-java-generics-different-from-c-templates-why-cant-i-use-int-as-a-para ).
So without templating, what would the multi-index class look like?
I imagine you would have your data class, e.g. Person, containing index members like a Map implementation. At this point, you have a choices:
- Add some "indexes" directly to
the Person class (like some
Hashtables) and write lookup
functions. Manage index
synchronization within the Person
class.
- Write an "IndexProvider" class
that decouples the index
functionality entirely from Person -
it would have to be able to
dynamically create different index
types and I would imagine you would
handle synchronization via
callbacks.
- Some mix of 1) and 2) - like an
abstract base class for index
functionality, which doesn't
properly decouple the behaviour but
does provide some code reuse.
I think, in the majority of cases 1) is the easiest to write, easiest to maintain and is probably the most performant. 2) seems like over-engineering.
The other option, if you have a lot of data structures that need indexing, is to store them in a database.