refactor to use java7 feature