abstracted continuousbag to support different collection implementations