Java String Extract extractGenericTypeNames(String sig)

Here you can find the source of extractGenericTypeNames(String sig)

Description

extract Generic Type Names

License

Open Source License

Declaration

public static List<String> extractGenericTypeNames(String sig) 

Method Source Code

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

import java.util.*;

public class Main {
    public static List<String> extractGenericTypeNames(String sig) {
        List<String> types = new ArrayList<String>();

        boolean nameDetected = false;
        int currentStart = -1;
        for (int i = 0; i < sig.length(); i++) {
            char c = sig.charAt(i);
            switch (c) {
            case '<':
            case ';':
                if (!nameDetected) {
                    nameDetected = true;
                    currentStart = i + 1;
                }//from  ww  w. j a va2 s  .co m
                break;
            case ':':
                types.add(sig.substring(currentStart, i));
                nameDetected = false;
                break;
            }
        }

        return types;
    }
}

Related

  1. extractArrayData(String input, StringBuilder output)
  2. extractCharNgram(String content, int n)
  3. extractCommands(String fileContents)
  4. extractData(String message)
  5. extractField(int position, String regex, String source)
  6. extractHorizontalTabs(String line, int tabSize)
  7. extractItems(String items)
  8. extractJobId(String line)
  9. extractKeyCodes(String codes)