Cloning vs. Instantiating a new class
问题 Is cloning good practice in this case? How to do it better? public ModelCollection startParsing() { return parseFeed(new ModelSpecialEntry); } public ModelCollection parseFeed(ModelEntry pattern) { ModelCollection modelCollection = new ModelCollection(); while( condition ) { //TODO: Is cloning the best solution? ModelEntry model = (ModelEntry) pattern.clone(); model.parse(); //add this item to an collection modelCollection.add(model); } return modelCollection; } 回答1: Cloning is rarely a good