public static void tripSuggestions(
      List<CharSequence> suggestions, final int maxSuggestions, List<CharSequence> stringsPool) {
    while (suggestions.size() > maxSuggestions) {
      removeSuggestion(suggestions, maxSuggestions, stringsPool);
    }
  }
@Test
  public void testTrimSuggestionsWithMultipleRecycleBackToPool() {
    ArrayList<CharSequence> list =
        new ArrayList<>(
            Arrays.<CharSequence>asList(
                "typed",
                "something",
                "duped",
                new StringBuilder("duped"),
                new StringBuilder("new"),
                new StringBuilder("car"),
                "something"));
    Assert.assertEquals(0, mStringPool.size());

    IMEUtil.tripSuggestions(list, 2, mStringPool);
    Assert.assertEquals(2, list.size());

    Assert.assertEquals("typed", list.get(0));
    Assert.assertEquals("something", list.get(1));

    Assert.assertEquals(3, mStringPool.size());
    Assert.assertEquals("duped", mStringPool.get(0).toString());
    Assert.assertTrue(mStringPool.get(0) instanceof StringBuilder);
    Assert.assertEquals("new", mStringPool.get(1).toString());
    Assert.assertTrue(mStringPool.get(1) instanceof StringBuilder);
    Assert.assertEquals("car", mStringPool.get(2).toString());
    Assert.assertTrue(mStringPool.get(2) instanceof StringBuilder);
  }