How to access java collection, just like the table in the database, having indexes and LINQ-like que
        Posted  
        
            by Shaman
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Shaman
        
        
        
        Published on 2010-05-06T12:36:43Z
        Indexed on 
            2010/05/06
            12:58 UTC
        
        
        Read the original article
        Hit count: 255
        
This task occurs from time to time in my projects. I need to handle a collection of some complex elements, having different attributes, such as login, password_hash, role, etc. And, I need to be able to query that collection, just like I query a table in the database, having only partial data. For example: get all users, with role "user". Or check, if there's a user with login "root" and role "superuser". Removing items, based on same data is also needed. The first attempt I've tried is to use Google collections, Apache collections, and lambdaj. All of them have very similar preicate mechanism, but with a great disadvantage: it is based on iteration, one by one, over the collection of items, which is not good, for often used collections, containing big amounts of data. Could you please suggest me some solution? Thanks.
© Stack Overflow or respective owner