Showing posts with label reinventing the weel. Show all posts
Showing posts with label reinventing the weel. Show all posts

17 February 2012

Reinventing the wheel: Collection.size()

 Original way to reinvent the wheel - by an examination of "Programming Fundamentals"
 
public class MyContainer {
   private final Collection myBag;

   public int getBagSize() {
    int j = 0;
    for(int i = 0; i < this.myBag.size(); i++) {
     j++;
    }
    return j;
   }
}