What causes this retainAll exception?

Posted by Joren on Stack Overflow See other posts from Stack Overflow or by Joren
Published on 2010-05-20T00:57:08Z Indexed on 2010/05/20 1:00 UTC
Read the original article Hit count: 298

java.lang.UnsupportedOperationException: This operation is not supported on Query Results
    at org.datanucleus.store.query.AbstractQueryResult.contains(AbstractQueryResult.java:250)
    at java.util.AbstractCollection.retainAll(AbstractCollection.java:369)
    at namespace.MyServlet.doGet(MyServlet.java:101)

I'm attempting to take one list I retrieved from a datastore query, and keep only the results which are also in a list I retrieved from a list of keys. Both my lists are populated as expected, but I can't seem to user retainAll on either one of them.

//                  List<Data> listOne = new ArrayList(query.execute(theQuery));
//                  DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
//                  List<Data> listTwo = new ArrayList(ds.get(keys).values());
//                  listOne.retainAll(listTwo);

© Stack Overflow or respective owner

Related posts about java

Related posts about collections