try to use this code
public static void main(String[] args) { List<String> verticesposition2 = new ArrayList<String>(); verticesposition2.add("safdsfVertex"); verticesposition2.add("safdsfNamesfsd"); verticesposition2.add("notCONTAINS"); for (String str5 : verticesposition2){ if(!(str5.contains("Vertex")||str5.contains("Name")||str5.contains("Transmittance"))){ System.out.println(str5); } } }
Output:
notCONTAINS
if speed isn't critical -- use those with regexp.