method was using stream and foreach together. We changed foreach to stream

Also, using stream's toList() eliminates the need to use Collections.unmodifiableList().

Comment From: philwebb

Thanks, but I think I prefer the code as it is.