### Question:
ListMemoizer { public boolean put(final ListNode<T> list, final M memo) { if (null == list) { throw new IllegalArgumentException("null key"); } if (list.isNil()) { throw new IllegalArgumentException("the empty list cannot be memoized"); } if (null == helper) { helper = new ListMemoizerHelper(list, memo); return true; } else { return helper.put(list, memo); } } ListMemoizer(final Comparator<T> comparator); M get(final ListNode<T> list); boolean put(final ListNode<T> list, final M memo); boolean remove(final ListNode<T> list);  }### Answer:
@Test public void testAsSetOfLists() throws Exception { ListMemoizer<String, Integer> m = createMemoizer(); assertTrue(m.put(createList("foo"), 42)); assertFalse(m.put(createList("foo"), 42)); assertTrue(m.put(createList("foo", "bar"), 42)); assertTrue(m.put(createList("one", "two", "three"), 42)); assertTrue(m.put(createList("one"), 42)); assertFalse(m.put(createList("one", "two", "three"), 42)); }