RemotedList

I want to create a library to solve a problem which happens to me very often working with RMI and JPA. Consider having a remote server object with an interface like this:
public Server implements Remote{
    List<Foo> getFoos() throws RemoteException;
}
According to the the RMI specification calling this method will cause that the resulting List is serialized and passed back over the network to the client. Consider the case when the resulting list is huge and you don't want pass such a big thing over the network or consider the case when the list is not serializable. My remoted-list library will address these problems replacing a the actual list with a remoted version that lazily load the elements. The usage of remote-list is simple. Consider the getFoos() implementation:
List<Foo> getFoos() {
   List<Foo> actualList = ... // create or get a list according your business logic
   List<Foo> remotedList = RemotedList.remotize(actualList);

   return remotedList;
}
Instead to returning the actualList the method returns a remotedList which reflects the contents of the actualList mantaining a remote reference to actualList. The remoteList is also Serializable and ligth to serialize because it contains only a remote reference to the actualList instead to contains all reference of all elements. Now consider the client which retrieve the remotedList from the remote object.
remotedList = server.getFoos();
...
element = remoteList.get(index);
When the client call remoteList.get(index) the remoteList acts like a proxy and call through RMI the get(index) method on the actualList which was left on the server JVM. This is the idea. Soon I will prepare the library and I will release it for you all! UPATE 2008-05-15 I wrote the code and I put it online throuh Google Code. The project is hosted at http://code.google.com/p/remoted-list/.