Java Args Parse getPossibleCompletionsForGivenArgs(String[] args, String[] possibilitiesOfCompletion)

Here you can find the source of getPossibleCompletionsForGivenArgs(String[] args, String[] possibilitiesOfCompletion)

Description

get Possible Completions For Given Args

License

Open Source License

Declaration

public static List<String> getPossibleCompletionsForGivenArgs(String[] args,
            String[] possibilitiesOfCompletion) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<String> getPossibleCompletionsForGivenArgs(String[] args,
            String[] possibilitiesOfCompletion) {
        String argumentToFindCompletionFor = args[args.length - 1];

        List<String> listOfPossibleCompletions = new ArrayList<String>();

        for (int i = 0; i < possibilitiesOfCompletion.length; ++i) {
            String foundString = possibilitiesOfCompletion[i];

            if (foundString.regionMatches(true, 0, argumentToFindCompletionFor, 0,
                    argumentToFindCompletionFor.length())) {
                listOfPossibleCompletions.add(foundString);
            }/*from  w ww  .  ja v  a  2  s.c  o m*/
        }

        return listOfPossibleCompletions;
    }
}

Related

  1. getPossibleCompletionsForGivenArgs(String[] args, String[] possibilitiesOfCompletion)
  2. parse(String[] args)
  3. parse(String[] args)
  4. parseAndFillFittingValues(String[] prefixes, String[] values)
  5. parseArg(String[] args)