code: public boolean add(String s) {
          SortedSet<String> sub = headSet(s);
          if (!sub.isEmpty() && s.startsWith((String)sub.last())) {
              // no need to add; prefix is already present
              return false;
          }
          boolean retVal = super.add(s);
          sub = tailSet(s+"\0");
          while(!sub.isEmpty() && ((String)sub.first()).startsWith(s)) {
              // remove redundant entries
              sub.remove(sub.first());
          }
          return retVal;
      }
docs: Maintains additional invariant: if one entry is a
  prefix of another, keep only the prefix.
  
  @see java.util.Collection#add(java.lang.Object)