using method reference to do less code

using method reference to do less code