U
- type of the userspublic class SimpleFastUserIndex<U> extends Object implements FastUserIndex<U>, Serializable
Modifier | Constructor and Description |
---|---|
protected |
SimpleFastUserIndex()
Empty constructor: no users.
|
Modifier and Type | Method and Description |
---|---|
protected int |
add(U u)
Add a new user to the index.
|
boolean |
containsUser(U u)
Checks whether the index contains a user.
|
Stream<U> |
getAllUsers()
Retrieves a stream of the indexed users.
|
static <U> SimpleFastUserIndex<U> |
load(Stream<U> users)
Creates a user index from a stream of user objects.
|
int |
numUsers()
Counts the number of indexed users.
|
U |
uidx2user(int uidx)
Returns the user represented with the index.
|
int |
user2uidx(U u)
Returns the index assigned to the user.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAllUidx, uidx2user, uidx2user, user2uidx, user2uidx
public boolean containsUser(U u)
UserIndex
containsUser
in interface UserIndex<U>
containsUser
in interface FastUserIndex<U>
u
- userpublic int numUsers()
UserIndex
public Stream<U> getAllUsers()
UserIndex
getAllUsers
in interface UserIndex<U>
getAllUsers
in interface FastUserIndex<U>
public int user2uidx(U u)
FastUserIndex
user2uidx
in interface FastUserIndex<U>
u
- userpublic U uidx2user(int uidx)
FastUserIndex
uidx2user
in interface FastUserIndex<U>
uidx
- user indexprotected int add(U u)
u
- id of the userpublic static <U> SimpleFastUserIndex<U> load(Stream<U> users)
U
- type of the usersusers
- stream of user objectsCopyright © 2016. All rights reserved.