nntrn
1/31/2019 - 10:51 AM

[print class attributes]

[print class attributes]

		List<String> allWordsList = Arrays.asList("name", "age", "height", "dob", "gender");

		String[] validItems = new String[] { "name", "age", "height", "dob", "gender" };

		items = items.replace(" ", "");
		String[] arr = items.split(";");

		List<String> avoidWordList = Arrays.asList(arr);

		allWordsList.stream().filter(line -> avoidWordList.stream().allMatch(s -> s.equalsIgnoreCase(s)))
				.collect(Collectors.toList()).forEach(System.out::println);

		System.out.println(avoidWordList);

		Class c = this.getClass();

		for (Field f : c.getDeclaredFields()) {
			f.setAccessible(true);
			try {
				if (Arrays.asList(arr).indexOf(f.getName()) > -1)
					System.out.println(f.getName() + " = " + f.get(this));
			} catch (Exception e) {
				e.printStackTrace();
			}
		}