A discussion for this... talk about all the stuff in it!
newList.clear(); for (String str : masterList) { int length = inputString.length(); if (str.length() >= length) if (str.substring(0, length).compareToIgnoreCase(inputString) == 0) newList.add(str); }