/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	private static final String SOME_CONSTANT = "A";
	
	private static boolean java7(List<String> variables,List<String> attrNames){
		for (String variable : variables) {
			boolean validAttribute = false;
			if (variable.equals(SOME_CONSTANT)) {
				validAttribute = true;
			} else {
				for (String attrName : attrNames) {

					if (variable.equals(attrName)) {
						validAttribute = true;
						break;
					}
				}
			}
			if (!validAttribute) {
				return false;
			}
		}
		return true;
	}
	
	private static boolean java8(List<String> variables,List<String> attrNames){
	return variables.stream().allMatch((item) -> item.equals(SOME_CONSTANT) || attrNames.contains(item));
	}
	
	public static void main (String[] args) throws java.lang.Exception
	{
		List<String> attrNames = Arrays.asList("a", "b", "c");
		List<String> noMatch = Arrays.asList("x", "b", "c");
		List<String> match = Arrays.asList("a", "b", "c");
		List<String> constant = Arrays.asList("a", "b", "c");
		
		System.out.println(java7(noMatch,attrNames)+" "+java8(noMatch,attrNames));
		System.out.println(java7(match,attrNames)+" "+java8(match,attrNames));
		System.out.println(java7(constant,attrNames)+" "+java8(constant,attrNames));
		
	}
}