If there is any common start string in the completion list, return it

@param coList completion list
@return common start string
195500
public static String findStartsWithOperation(List<? extends CompleteOperation> coList) {
        List<String> tmpList = new ArrayList<>();
        for (CompleteOperation co : coList) {
            String s = findStartsWith(co.getFormattedCompletionCandidates());
            if (s.length() > 0)
                tmpList.add(s);
            else
                return "";
        }
        return findStartsWith(tmpList);
    }
910503
public Object beginContext(ComponentMetaData cmd) { // modified to return object d131914
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            if (cmd != null)
                Tr.debug(tc, "begin context " + cmd.getJ2EEName());
            else
                Tr.debug(tc, "NULL was passed.");
        }

        if (cmd == null) {
            Tr.error(tc, "WSVR0603E"); // d143991
            throw new IllegalArgumentException(Tr.formatMessage(tc, "WSVR0603E"));
        }

        return threadContext.beginContext(cmd); //131914
    }
253821
T getClosedFiniteStart() {

        T temporal = this.start.getTemporal();

        if ((temporal != null) && this.start.isOpen()) {
            return this.getTimeLine().stepForward(temporal);
        } else {
            return temporal;
        }

    }
278740
public MatcherPath commonPrefix(MatcherPath that) {
        checkArgNotNull(that, "that");
        if (element.level > that.element.level) return parent.commonPrefix(that);
        if (element.level < that.element.level) return commonPrefix(that.parent);
        if (this == that) return this;
        return (parent != null && that.parent != null) ? parent.commonPrefix(that.parent) : null;
    }
175021
public static boolean startWith(@Nullable CharSequence s, char c) {
		if (StringUtils.isEmpty(s)) {
			return false;
		}
		return s.charAt(0) == c;
	}
1279037
public Object getDefault()
    {
        Object objDefault = super.getDefault();
        if (objDefault == null)
            objDefault = FINISH_START;
        return objDefault;
    }
1114999
public StringGrabberList getStringEnclosedIn(String startToken, String endToken) {
		return new StringGrabberList(getCropper().getStringEnclosedIn(sb.toString(), startToken, endToken));
	}
304706
public HashSet<String> getStringsStartingWith(String prefixStr)
    {
        HashSet<String> strHashSet = new HashSet<String>();

        if (sourceNode != null)      //if the MDAG hasn't been simplified
        {
            MDAGNode originNode = sourceNode.transition(prefixStr);  //attempt to _transition down the path denoted by prefixStr

            if (originNode != null) //if there a _transition path corresponding to prefixString (one or more stored Strings begin with prefixString)
            {
                if (originNode.isAcceptNode()) strHashSet.add(prefixStr);
                getStrings(strHashSet, SearchCondition.PREFIX_SEARCH_CONDITION, prefixStr, prefixStr, originNode.getOutgoingTransitions());   //retrieve all Strings that extend the _transition path denoted by prefixStr
            }
        }
        else
        {
            SimpleMDAGNode originNode = SimpleMDAGNode.traverseMDAG(mdagDataArray, simplifiedSourceNode, prefixStr);      //attempt to _transition down the path denoted by prefixStr

            if (originNode != null)      //if there a _transition path corresponding to prefixString (one or more stored Strings begin with prefixStr)
            {
                if (originNode.isAcceptNode()) strHashSet.add(prefixStr);
                getStrings(strHashSet, SearchCondition.PREFIX_SEARCH_CONDITION, prefixStr, prefixStr, originNode);        //retrieve all Strings that extend the _transition path denoted by prefixString
            }
        }

        return strHashSet;
    }
555010
public static List<String> getWords(int count, boolean startLorem) {
        LinkedList<String> wordList = new LinkedList<String>();

        if (startLorem) {
            if (count > COMMON_WORDS.length) {
                wordList.addAll(Arrays.asList(COMMON_WORDS));

            } else {
                // add first "count" words
                for (int i = 0; i < count; i++) {
                    wordList.add(COMMON_WORDS[i]);
                }
            }
        }

        // add remaining words (random)
        for (int i = wordList.size(); i < count; i++) {
            wordList.add(QuickUtils.math.getRandomPosition(DICTIONARY));
        }

        return wordList;
    }
1163993
function(segment) {
                return (this.start.eql(segment.start) && this.end.eql(segment.end)) ||
                    (this.start.eql(segment.end) && this.end.eql(segment.start));
              }
1176100
def get_common_complete_suffix(document, completions):
    
    # Take only completions that don't change the text before the cursor.
    def doesnt_change_before_cursor(completion):
        end = completion.text[:-completion.start_position]
        return document.text_before_cursor.endswith(end)

    completions2 = [c for c in completions if doesnt_change_before_cursor(c)]

    # When there is at least one completion that changes the text before the
    # cursor, don't return any common part.
    if len(completions2) != len(completions):
        return ''

    # Return the common prefix.
    def get_suffix(completion):
        return completion.text[-completion.start_position:]

    return _commonprefix([get_suffix(c) for c in completions2])
616476
public static List<StartEndPair> scan(String input, String splitStart,
			String splitEnd, boolean useEscaping) {
		List<StartEndPair> result = new ArrayList<StartEndPair>();
		int fromIndex = 0;
		while (true) {
			int exprStart = input.indexOf(splitStart, fromIndex);
			if (exprStart == -1) {
				break;
			}
			if (useEscaping && Util.isEscaped(input, exprStart)) {
				fromIndex = exprStart + splitStart.length();
				continue;
			}

			exprStart += splitStart.length();
			int exprEnd = input.indexOf(splitEnd, exprStart);
			if (exprEnd == -1) {
				break;
			}
			while (useEscaping && Util.isEscaped(input, exprEnd)) {
				exprEnd = input.indexOf(splitEnd, exprEnd + splitEnd.length());
			}

			fromIndex = exprEnd + splitEnd.length();

			StartEndPair startEndPair = new StartEndPair(exprStart, exprEnd);
			result.add(startEndPair);
		}
		return result;
	}
411981
def common_start(strings):
    

    def gen_start_strings(string):
        """Generator that yield start sub-strings of length 1, 2, ..."""

        for i in xrange(1, len(string) + 1):
            yield string[:i]

    # Empty strings list
    if not strings:
        return ""

    start_string = ""

    # Get sucessively start string of 1st string
    for start_string in gen_start_strings(max(strings)):
        if not all(string.startswith(start_string) for string in strings):
            return start_string[:-1]

    return start_string
118240
private CompletionFailure newCompletionFailure(TypeSymbol c,
                                                       JCDiagnostic diag) {
            if (!cacheCompletionFailure) {
                // log.warning("proc.messager",
                //             Log.getLocalizedString("class.file.not.found", c.flatname));
                // c.debug.printStackTrace();
                return new CompletionFailure(c, diag);
            } else {
                CompletionFailure result = cachedCompletionFailure;
                result.sym = c;
                result.diag = diag;
                return result;
            }
        }
606244
private static String getCommaSeparatedStringForPathMapping(Collection<PathMapping> coll) {

		StringBuilder buffer = new StringBuilder();
		for (Iterator<PathMapping> eltIterator = coll.iterator(); eltIterator.hasNext();) {
			PathMapping mapping = eltIterator.next();
			buffer.append(mapping.getPath());
			if (mapping.isRecursive()) {
				buffer.append("**");
			}
			if (eltIterator.hasNext()) {
				buffer.append(COMMA_SEPARATOR);
			}
		}
		return buffer.toString();
	}
583594
public SimpleEntry getFirst()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "getFirst");

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(this, tc, "getFirst", new Object[] {first, printList()});
    
    return first;          
  }
363141
public static int getStartPos(JCTree tree) {
        if (tree == null)
            return Position.NOPOS;

        switch(tree.getTag()) {
            case MODULEDEF: {
                JCModuleDecl md = (JCModuleDecl)tree;
                return md.mods.annotations.isEmpty() ? md.pos :
                       md.mods.annotations.head.pos;
            }
            case PACKAGEDEF: {
                JCPackageDecl pd = (JCPackageDecl)tree;
                return pd.annotations.isEmpty() ? pd.pos :
                       pd.annotations.head.pos;
            }
            case APPLY:
                return getStartPos(((JCMethodInvocation) tree).meth);
            case ASSIGN:
                return getStartPos(((JCAssign) tree).lhs);
            case BITOR_ASG: case BITXOR_ASG: case BITAND_ASG:
            case SL_ASG: case SR_ASG: case USR_ASG:
            case PLUS_ASG: case MINUS_ASG: case MUL_ASG:
            case DIV_ASG: case MOD_ASG:
            case OR: case AND: case BITOR:
            case BITXOR: case BITAND: case EQ:
            case NE: case LT: case GT:
            case LE: case GE: case SL:
            case SR: case USR: case PLUS:
            case MINUS: case MUL: case DIV:
            case MOD:
            case POSTINC:
            case POSTDEC:
                return getStartPos(((JCOperatorExpression) tree).getOperand(LEFT));
            case CLASSDEF: {
                JCClassDecl node = (JCClassDecl)tree;
                if (node.mods.pos != Position.NOPOS)
                    return node.mods.pos;
                break;
            }
            case CONDEXPR:
                return getStartPos(((JCConditional) tree).cond);
            case EXEC:
                return getStartPos(((JCExpressionStatement) tree).expr);
            case INDEXED:
                return getStartPos(((JCArrayAccess) tree).indexed);
            case METHODDEF: {
                JCMethodDecl node = (JCMethodDecl)tree;
                if (node.mods.pos != Position.NOPOS)
                    return node.mods.pos;
                if (node.typarams.nonEmpty()) // List.nil() used for no typarams
                    return getStartPos(node.typarams.head);
                return node.restype == null ? node.pos : getStartPos(node.restype);
            }
            case SELECT:
                return getStartPos(((JCFieldAccess) tree).selected);
            case TYPEAPPLY:
                return getStartPos(((JCTypeApply) tree).clazz);
            case TYPEARRAY:
                return getStartPos(((JCArrayTypeTree) tree).elemtype);
            case TYPETEST:
                return getStartPos(((JCInstanceOf) tree).expr);
            case ANNOTATED_TYPE: {
                JCAnnotatedType node = (JCAnnotatedType) tree;
                if (node.annotations.nonEmpty()) {
                    if (node.underlyingType.hasTag(TYPEARRAY) ||
                            node.underlyingType.hasTag(SELECT)) {
                        return getStartPos(node.underlyingType);
                    } else {
                        return getStartPos(node.annotations.head);
                    }
                } else {
                    return getStartPos(node.underlyingType);
                }
            }
            case NEWCLASS: {
                JCNewClass node = (JCNewClass)tree;
                if (node.encl != null)
                    return getStartPos(node.encl);
                break;
            }
            case VARDEF: {
                JCVariableDecl node = (JCVariableDecl)tree;
                if (node.mods.pos != Position.NOPOS) {
                    return node.mods.pos;
                } else if (node.vartype == null) {
                    //if there's no type (partially typed lambda parameter)
                    //simply return node position
                    return node.pos;
                } else {
                    return getStartPos(node.vartype);
                }
            }
            case ERRONEOUS: {
                JCErroneous node = (JCErroneous)tree;
                if (node.errs != null && node.errs.nonEmpty())
                    return getStartPos(node.errs.head);
            }
        }
        return tree.pos;
    }