Java and collection partitioning