public static Collection<String> getTrimmedStringCollection(String str,
      String delim) {
    List<String> values = new ArrayList<String>();
    if (str == null)
      return values;
    StringTokenizer tokenizer = new StringTokenizer(str, delim);
    while (tokenizer.hasMoreTokens()) {
      String next = tokenizer.nextToken();
      if (next == null || next.trim().isEmpty()) {
        continue;
      }
      values.add(next.trim());
    }
    return values;
  }
@Test 
  public void testGetUniqueNonEmptyTrimmedStrings (){
    final String TO_SPLIT = ",foo, bar,baz,,blah,blah,bar,";
    Collection<String> col = StringUtils.getTrimmedStringCollection(TO_SPLIT);
    assertEquals(4, col.size());
    assertTrue(col.containsAll(Arrays.asList(new String[]{"foo","bar","baz","blah"})));
  }