I have a large HashMap<Integer, MyObject>
which is located on a server. I need to send a String
from MyObject
across a network to a client. My problem is that I can't figure out a good way to keep track of what MyObject
has already been accessed to send the String
.
I'd like it so that the client can repeatedly call the server's function to retrieve the String
, then the client can add all the String
s to an ArrayList
. The server would indicate all the String
s have been sent by returning null
.
I can't simply send an ArrayList<String>
of all the String
s as I am limited to a tiny message size due to the use of RSA encryption.
The only way I've thought of so far is to keep a static instance variable HashSet<Integer>
that holds all of the already accessed MyObject
s. But this would mean I'd have to cross reference the HashMap
to the HashSet
for every lookup. There must be a better way.