UGI#getGroups and its usage is inefficient. The list is unnecessarily converted to multiple collections.
For every invocation, the List<String> from the group provider is converted into a LinkedHashSet<String> (to de-dup), back to a String. Then callers testing for group membership convert back to a List<String>. This should be done once to reduce allocations.