{"action":"opened","issue":{"url":"https://api.github.com/repos/unruly/java-8-matchers/issues/3","labels_url":"https://api.github.com/repos/unruly/java-8-matchers/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/unruly/java-8-matchers/issues/3/comments","events_url":"https://api.github.com/repos/unruly/java-8-matchers/issues/3/events","html_url":"https://github.com/unruly/java-8-matchers/issues/3","id":129085854,"number":3,"title":"contains(..) is not null-safe","user":{"login":"runeflobakk","id":174823,"avatar_url":"https://avatars.githubusercontent.com/u/174823?v=3","gravatar_id":"","url":"https://api.github.com/users/runeflobakk","html_url":"https://github.com/runeflobakk","followers_url":"https://api.github.com/users/runeflobakk/followers","following_url":"https://api.github.com/users/runeflobakk/following{/other_user}","gists_url":"https://api.github.com/users/runeflobakk/gists{/gist_id}","starred_url":"https://api.github.com/users/runeflobakk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/runeflobakk/subscriptions","organizations_url":"https://api.github.com/users/runeflobakk/orgs","repos_url":"https://api.github.com/users/runeflobakk/repos","events_url":"https://api.github.com/users/runeflobakk/events{/privacy}","received_events_url":"https://api.github.com/users/runeflobakk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-27T09:37:58Z","updated_at":"2016-01-27T09:37:58Z","closed_at":null,"body":"A Stream may contain `nulls` (though whether that's a good idea is up for debate ;) ), but `StreamMatchers.contains(..)` is not null safe. A workaround is to collect the steam to e.g. a List and use Hamcrest's `Matchers.contains(..)`, which handles expected null-elements. The workaround also demonstrates that `StreamMatchers.contains(..)` should indeed handle null-elements.\r\n\r\nThe sollution is simple. Just replace the `nextExpected.equals(nextActual)` (https://github.com/unruly/java-8-matchers/blob/master/src/main/java/co/unruly/matchers/StreamMatchers.java#L650) with `java.util.Objects.equals(nextExpected, nextActual)`, and it handles expected null-elements.\r\n\r\nI have implemented the fix with testcase that I will issue a pull request for.\r\n\r\nThanks for making the library!"}}