I\'m writing an adapter framework where I need to convert a list of objects from one class to another. I can iterate through the source list to do this as in
Java: Best
I think you would either have to create a custom List (implementing the List interface) or a custom Iterator. For example:
ArrayList targetList = new ArrayList();
ConvertingIterator iterator = new ConvertingIterator(targetList);
// and here you would have to use a custom List implementation as a source List
// using the Iterator created above
But I doubt that this approach would save you much.