simple pattern matching for java8