Skip to content

Instantly share code, notes, and snippets.

@MrChebik
Created August 24, 2018 10:02
Show Gist options
  • Save MrChebik/998e3b1cadbc6e4ab28cf3c741fa3fe4 to your computer and use it in GitHub Desktop.
Save MrChebik/998e3b1cadbc6e4ab28cf3c741fa3fe4 to your computer and use it in GitHub Desktop.
Id - Collector
public class CollectorAutocompleteText {
public static String[] flag;
public static List<String> packageName;
public static List<String> returnTypeS;
static {
flag = new String[] {"A", "C", "I", "M", "V", "?"};
packageName = new ArrayList<>();
returnTypeS = new ArrayList<>();
}
public static int addPackageName(String text) {
return addToList(packageName, text);
}
public static int addReturnTypeS(String text) {
return addToList(returnTypeS, text);
}
private static int addToList(List<String> list, String text) {
for (int i = 0; i < list.size(); i++)
if (list.get(i).equals(text))
return i;
list.add(text);
return list.size() - 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment