### Question:
CategorizedCircularBuffer { public List<T> subListByKey(K key, int fromIndex, int toIndex) { LinkedList<T> typedList = typedLists.get(key); if (typedList == null) return Collections.EMPTY_LIST; return typedList.subList(fromIndex, toIndex); } CategorizedCircularBuffer(int maxCount); void add(K key, T value); List<T> subList(int fromIndex, int toIndex); int size(); List<T> subListByKey(K key, int fromIndex, int toIndex); int sizeByKey(K key);  }### Answer:
@Test public void testSubListByKey() { CategorizedCircularBuffer<String, Long> ccb = new CategorizedCircularBuffer<String, Long>(6); ccb.add(1l, "e0"); ccb.add(2l, "e1"); ccb.add(1l, "e2"); ccb.add(2l, "e3"); ccb.add(1l, "e4"); ccb.add(2l, "e5"); List l = ccb.subListByKey(1l, 1, 3); assertEquals(2, l.size()); assertEquals("e2", l.get(0)); assertEquals("e0", l.get(1)); }