Make these methods const and use STL algorithms rather than manual loops to more clearly indicate intent.