Example #1
0
 /** Return the first object on the free list or null if none. */
 public FactoryObject getFree() {
   Head head = getHead();
   FactoryObject obj = head.next;
   if (obj != null) {
     head.next = obj.next();
     obj.next(null);
   }
   return obj;
 }
Example #2
0
 /** Add an object to the free list. */
 public void setFree(FactoryObject obj) {
   Head head = getHead();
   obj.next(head.next);
   head.next = obj;
 }