{"action":"created","issue":{"url":"https://api.github.com/repos/zbra-solutions/android-linq/issues/3","labels_url":"https://api.github.com/repos/zbra-solutions/android-linq/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/zbra-solutions/android-linq/issues/3/comments","events_url":"https://api.github.com/repos/zbra-solutions/android-linq/issues/3/events","html_url":"https://github.com/zbra-solutions/android-linq/issues/3","id":62480879,"number":3,"title":"Discussion: single and first behavior","user":{"login":"alercunha","id":5490771,"avatar_url":"https://avatars.githubusercontent.com/u/5490771?v=3","gravatar_id":"","url":"https://api.github.com/users/alercunha","html_url":"https://github.com/alercunha","followers_url":"https://api.github.com/users/alercunha/followers","following_url":"https://api.github.com/users/alercunha/following{/other_user}","gists_url":"https://api.github.com/users/alercunha/gists{/gist_id}","starred_url":"https://api.github.com/users/alercunha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alercunha/subscriptions","organizations_url":"https://api.github.com/users/alercunha/orgs","repos_url":"https://api.github.com/users/alercunha/repos","events_url":"https://api.github.com/users/alercunha/events{/privacy}","received_events_url":"https://api.github.com/users/alercunha/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-03-17T18:42:13Z","updated_at":"2015-03-18T16:00:38Z","closed_at":null,"body":"Should single and first throw an exception or return null by default?\r\n\r\nWhen writing code what is preferred?\r\n\r\n    int? x = list.single(x -> x == 2);\r\n    if (x == null)\r\n        // throw exception\r\n\r\nOr\r\n\r\n    int x = list.single(x == 2); // will throw an exception because there's no \r\n\r\nThe alternative would be:\r\n\r\n    int? x = list.singleOrDefault(x -> x == 2);\r\n    \r\nWhy was the behavior of single and first chosen to be \"return default(T) in case it doesn't find the item\"?"},"comment":{"url":"https://api.github.com/repos/zbra-solutions/android-linq/issues/comments/83034489","html_url":"https://github.com/zbra-solutions/android-linq/issues/3#issuecomment-83034489","issue_url":"https://api.github.com/repos/zbra-solutions/android-linq/issues/3","id":83034489,"user":{"login":"fabiofalavinha","id":886718,"avatar_url":"https://avatars.githubusercontent.com/u/886718?v=3","gravatar_id":"","url":"https://api.github.com/users/fabiofalavinha","html_url":"https://github.com/fabiofalavinha","followers_url":"https://api.github.com/users/fabiofalavinha/followers","following_url":"https://api.github.com/users/fabiofalavinha/following{/other_user}","gists_url":"https://api.github.com/users/fabiofalavinha/gists{/gist_id}","starred_url":"https://api.github.com/users/fabiofalavinha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabiofalavinha/subscriptions","organizations_url":"https://api.github.com/users/fabiofalavinha/orgs","repos_url":"https://api.github.com/users/fabiofalavinha/repos","events_url":"https://api.github.com/users/fabiofalavinha/events{/privacy}","received_events_url":"https://api.github.com/users/fabiofalavinha/received_events","type":"User","site_admin":false},"created_at":"2015-03-18T16:00:38Z","updated_at":"2015-03-18T16:00:38Z","body":"Yep... let's make a \"Panelaço\" if Bruno doesn change the API!!!! :P"}}