@Test public void testFree(){ assertEquals(0, k.size()); k.add(testString); k.free(); assertEquals(0, k.size()); assertEquals(0, k.size()); k.add(testString); k.add(testString); k.free(); assertEquals(0, k.size()); }
public void free() { Key current = head; Key next = null; while (current != null) { if (current.getNext() != null) { next = current.getNext(); } current.setNext(null); current.setPrev(null); current.setValue(null); current = next; next = null; } head = tail = null; size = 0; }
KeyBuffer { public void free() { Key current = head; Key next = null; while (current != null) { if (current.getNext() != null) { next = current.getNext(); } current.setNext(null); current.setPrev(null); current.setValue(null); current = next; next = null; } head = tail = null; size = 0; } }
KeyBuffer { public void free() { Key current = head; Key next = null; while (current != null) { if (current.getNext() != null) { next = current.getNext(); } current.setNext(null); current.setPrev(null); current.setValue(null); current = next; next = null; } head = tail = null; size = 0; } KeyBuffer(); }
KeyBuffer { public void free() { Key current = head; Key next = null; while (current != null) { if (current.getNext() != null) { next = current.getNext(); } current.setNext(null); current.setPrev(null); current.setValue(null); current = next; next = null; } head = tail = null; size = 0; } KeyBuffer(); void add(String s); int size(); @Override String toString(); String drain(); void free(); }
KeyBuffer { public void free() { Key current = head; Key next = null; while (current != null) { if (current.getNext() != null) { next = current.getNext(); } current.setNext(null); current.setPrev(null); current.setValue(null); current = next; next = null; } head = tail = null; size = 0; } KeyBuffer(); void add(String s); int size(); @Override String toString(); String drain(); void free();  }