code: private final String getUnambiguousCompletions(final List<?> candidates) {
          if (candidates == null || candidates.isEmpty()) {
              return null;
          }
  
          // convert to an array for speed
          String[] strings = candidates.toArray(new String[candidates.size()]);
  
          String first = strings[0];
          StringBuilder candidate = new StringBuilder();
  
          for (int i = 0, count = first.length(); i < count; i++) {
              if (startsWith(first.substring(0, i + 1), strings)) {
                  candidate.append(first.charAt(i));
              } else {
                  break;
              }
          }
  
          return candidate.toString();
      }
docs: Returns a root that matches all the {@link String} elements
  of the specified {@link List}, or null if there are
  no commalities. For example, if the list contains
  <i>foobar</i>, <i>foobaz</i>, <i>foobuz</i>, the
  method will return <i>foob</i>.