{"action":"created","issue":{"url":"https://api.github.com/repos/yegor256/cactoos/issues/1137","repository_url":"https://api.github.com/repos/yegor256/cactoos","labels_url":"https://api.github.com/repos/yegor256/cactoos/issues/1137/labels{/name}","comments_url":"https://api.github.com/repos/yegor256/cactoos/issues/1137/comments","events_url":"https://api.github.com/repos/yegor256/cactoos/issues/1137/events","html_url":"https://github.com/yegor256/cactoos/issues/1137","id":451174218,"node_id":"MDU6SXNzdWU0NTExNzQyMTg=","number":1137,"title":"Simplify responsibility and implementation of FirstOf","user":{"login":"victornoel","id":160975,"node_id":"MDQ6VXNlcjE2MDk3NQ==","avatar_url":"https://avatars0.githubusercontent.com/u/160975?v=4","gravatar_id":"","url":"https://api.github.com/users/victornoel","html_url":"https://github.com/victornoel","followers_url":"https://api.github.com/users/victornoel/followers","following_url":"https://api.github.com/users/victornoel/following{/other_user}","gists_url":"https://api.github.com/users/victornoel/gists{/gist_id}","starred_url":"https://api.github.com/users/victornoel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/victornoel/subscriptions","organizations_url":"https://api.github.com/users/victornoel/orgs","repos_url":"https://api.github.com/users/victornoel/repos","events_url":"https://api.github.com/users/victornoel/events{/privacy}","received_events_url":"https://api.github.com/users/victornoel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-06-02T09:58:13Z","updated_at":"2019-06-04T01:18:39Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I noticed that `FirstOf` was responsible of two different things:\r\n- to take one element in an `Iterable`\r\n- to filter an `Iterable`\r\n\r\nThis is its current constructor:\r\n```java\r\n    /**\r\n     * Constructor.\r\n     * @param cond Condition for getting the element\r\n     * @param src Source iterable\r\n     * @param fbck Fallback used if no value matches\r\n     */\r\n    public FirstOf(final Func<T, Boolean> cond, final Iterable<T> src, final Scalar<T> fbck) {\r\n```\r\n\r\nI think it would be much more maintainable if:\r\n- `FirstOf` was only responsible of taking the first element of an `Iterable`\r\n- It was implemented simply by delegating to `ItemAt`.\r\n\r\nThere is already `Filtered` to filter an `Iterable`, so one will be able to write:\r\n```java\r\nnew FirstOf<>(new Filtered<>(cond, iterable));\r\n```"},"comment":{"url":"https://api.github.com/repos/yegor256/cactoos/issues/comments/498482513","html_url":"https://github.com/yegor256/cactoos/issues/1137#issuecomment-498482513","issue_url":"https://api.github.com/repos/yegor256/cactoos/issues/1137","id":498482513,"node_id":"MDEyOklzc3VlQ29tbWVudDQ5ODQ4MjUxMw==","user":{"login":"llorllale","id":2019896,"node_id":"MDQ6VXNlcjIwMTk4OTY=","avatar_url":"https://avatars1.githubusercontent.com/u/2019896?v=4","gravatar_id":"","url":"https://api.github.com/users/llorllale","html_url":"https://github.com/llorllale","followers_url":"https://api.github.com/users/llorllale/followers","following_url":"https://api.github.com/users/llorllale/following{/other_user}","gists_url":"https://api.github.com/users/llorllale/gists{/gist_id}","starred_url":"https://api.github.com/users/llorllale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/llorllale/subscriptions","organizations_url":"https://api.github.com/users/llorllale/orgs","repos_url":"https://api.github.com/users/llorllale/repos","events_url":"https://api.github.com/users/llorllale/events{/privacy}","received_events_url":"https://api.github.com/users/llorllale/received_events","type":"User","site_admin":false},"created_at":"2019-06-04T01:18:39Z","updated_at":"2019-06-04T01:18:39Z","author_association":"COLLABORATOR","body":"@victornoel I wonder if we should just delete `FirstOf`"}}
{"actor":{"display_login":"llorllale"}}