private Promise < PeerSession > pickCachedSession ( int uid , final int keyGroupId ) { return ManagedList . of ( peerSessions . getValue ( uid ) ) . flatMap ( PeerSessionsStorage . SESSIONS ) . filter ( PeerSession . BY_THEIR_GROUP ( keyGroupId ) ) . sorted ( PeerSession . COMPARATOR ) . firstPromise ( ) ; }
Picking cached session