I committed a utility method at https://github.com/openmrs/openmrs-core/commit/19591f91d7384c5c8c799e65199e00d90e913340
except that it returns a set and no null values