src/main/java/com/zandero/utils/ResourceUtils.java
public static Set<String> getResourceWords(String resourceFile, Class clazz) {

		Assert.notNullOrEmptyTrimmed(resourceFile, "Missing resource file!");

		Scanner scanner = null;

		try {
			InputStream resource = clazz.getResourceAsStream(resourceFile);
			scanner = new Scanner(resource, UTF_8);

			Set<String> list = new LinkedHashSet<>();
			while (scanner.hasNext()) {
				String next = scanner.next();
				if (next != null && next.trim().length() > 0) {
					list.add(next);
				}
			}

			return list;
		}
		catch (Exception e) {
			return null;
		}
		finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
public static Set<String> getResourceWords(String resourceFile, Class clazz) {

		Assert.notNullOrEmptyTrimmed(resourceFile, "Missing resource file!");

		Scanner scanner = null;

		try {
			InputStream resource = clazz.getResourceAsStream(resourceFile);
			scanner = new Scanner(resource, UTF_8);

			Set<String> list = new LinkedHashSet<>();
			while (scanner.hasNext()) {
				String next = scanner.next();
				if (next != null && next.trim().length() > 0) {
					list.add(next);
				}
			}

			return list;
		}
		catch (Exception e) {
			return null;
		}
		finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
Loads resource as a set of Strings, where each word is added to the set

@param resourceFile to read
@param clazz        to use for resource access
@return set of strings (lines) or null if resource could not be read