@Test public void setupAndToString() { int size = 5; FixedSizeCircularLinkedList<AtomicInteger> list = new FixedSizeCircularLinkedList<AtomicInteger>(size, AtomicInteger.class); assertEquals("0:0,1:0,2:0,3:0,4:0", list.toString()); }
public String toString() { StringBuilder sb = new StringBuilder(); boolean first = true; for(Node<T> node = head; first || node != head; node = node.getNext()) { if (first) { first = false; } else { sb.append(","); } sb.append(node).append(":").append(node.getData()); } return sb.toString(); }
FixedSizeCircularLinkedList { public String toString() { StringBuilder sb = new StringBuilder(); boolean first = true; for(Node<T> node = head; first || node != head; node = node.getNext()) { if (first) { first = false; } else { sb.append(","); } sb.append(node).append(":").append(node.getData()); } return sb.toString(); } }
FixedSizeCircularLinkedList { public String toString() { StringBuilder sb = new StringBuilder(); boolean first = true; for(Node<T> node = head; first || node != head; node = node.getNext()) { if (first) { first = false; } else { sb.append(","); } sb.append(node).append(":").append(node.getData()); } return sb.toString(); } FixedSizeCircularLinkedList(int size, Class<T> type); }
FixedSizeCircularLinkedList { public String toString() { StringBuilder sb = new StringBuilder(); boolean first = true; for(Node<T> node = head; first || node != head; node = node.getNext()) { if (first) { first = false; } else { sb.append(","); } sb.append(node).append(":").append(node.getData()); } return sb.toString(); } FixedSizeCircularLinkedList(int size, Class<T> type); T head(); void rotateForward(); List<T> readBackward(int count); String toString(); }
FixedSizeCircularLinkedList { public String toString() { StringBuilder sb = new StringBuilder(); boolean first = true; for(Node<T> node = head; first || node != head; node = node.getNext()) { if (first) { first = false; } else { sb.append(","); } sb.append(node).append(":").append(node.getData()); } return sb.toString(); } FixedSizeCircularLinkedList(int size, Class<T> type); T head(); void rotateForward(); List<T> readBackward(int count); String toString();  }