{"action":"created","issue":{"url":"https://api.github.com/repos/javaslang/javaslang/issues/659","labels_url":"https://api.github.com/repos/javaslang/javaslang/issues/659/labels{/name}","comments_url":"https://api.github.com/repos/javaslang/javaslang/issues/659/comments","events_url":"https://api.github.com/repos/javaslang/javaslang/issues/659/events","html_url":"https://github.com/javaslang/javaslang/issues/659","id":109581237,"number":659,"title":"Add factory method 'fill' and 'tabulate' to collections","user":{"login":"danieldietrich","id":743833,"avatar_url":"https://avatars.githubusercontent.com/u/743833?v=3","gravatar_id":"","url":"https://api.github.com/users/danieldietrich","html_url":"https://github.com/danieldietrich","followers_url":"https://api.github.com/users/danieldietrich/followers","following_url":"https://api.github.com/users/danieldietrich/following{/other_user}","gists_url":"https://api.github.com/users/danieldietrich/gists{/gist_id}","starred_url":"https://api.github.com/users/danieldietrich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danieldietrich/subscriptions","organizations_url":"https://api.github.com/users/danieldietrich/orgs","repos_url":"https://api.github.com/users/danieldietrich/repos","events_url":"https://api.github.com/users/danieldietrich/events{/privacy}","received_events_url":"https://api.github.com/users/danieldietrich/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/javaslang/javaslang/labels/feature","name":"feature","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/javaslang/javaslang/milestones/18","html_url":"https://github.com/javaslang/javaslang/milestones/2.0.0","labels_url":"https://api.github.com/repos/javaslang/javaslang/milestones/18/labels","id":1091674,"number":18,"title":"2.0.0","description":"","creator":{"login":"danieldietrich","id":743833,"avatar_url":"https://avatars.githubusercontent.com/u/743833?v=3","gravatar_id":"","url":"https://api.github.com/users/danieldietrich","html_url":"https://github.com/danieldietrich","followers_url":"https://api.github.com/users/danieldietrich/followers","following_url":"https://api.github.com/users/danieldietrich/following{/other_user}","gists_url":"https://api.github.com/users/danieldietrich/gists{/gist_id}","starred_url":"https://api.github.com/users/danieldietrich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danieldietrich/subscriptions","organizations_url":"https://api.github.com/users/danieldietrich/orgs","repos_url":"https://api.github.com/users/danieldietrich/repos","events_url":"https://api.github.com/users/danieldietrich/events{/privacy}","received_events_url":"https://api.github.com/users/danieldietrich/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":239,"state":"open","created_at":"2015-04-30T20:29:59Z","updated_at":"2016-01-04T22:23:09Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2015-10-02T22:15:28Z","updated_at":"2016-01-04T23:17:47Z","closed_at":null,"body":"The `fill` create a collection of a specific size and fills the values using a Supplier or Function:\r\n\r\n```java\r\nstatic <T> Xxx<T> fill(int size, Supplier<? extends T> supplier);\r\n\r\nstatic <T> Xxx<T> tabulate(int size, Function<Integer, ? extends T> function);\r\n```\r\n\r\nExamples:\r\n\r\n```java\r\nList.fill(5, () -> \"test\");\r\n\r\nMap.tabulate(5, i -> new Entry<>(i, \"test\");\r\n```\r\n\r\n_29.12.15: Renamed `fill(int, Function)` to 'tabulate(int, Function)'_"},"comment":{"url":"https://api.github.com/repos/javaslang/javaslang/issues/comments/168841760","html_url":"https://github.com/javaslang/javaslang/issues/659#issuecomment-168841760","issue_url":"https://api.github.com/repos/javaslang/javaslang/issues/659","id":168841760,"user":{"login":"danieldietrich","id":743833,"avatar_url":"https://avatars.githubusercontent.com/u/743833?v=3","gravatar_id":"","url":"https://api.github.com/users/danieldietrich","html_url":"https://github.com/danieldietrich","followers_url":"https://api.github.com/users/danieldietrich/followers","following_url":"https://api.github.com/users/danieldietrich/following{/other_user}","gists_url":"https://api.github.com/users/danieldietrich/gists{/gist_id}","starred_url":"https://api.github.com/users/danieldietrich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danieldietrich/subscriptions","organizations_url":"https://api.github.com/users/danieldietrich/orgs","repos_url":"https://api.github.com/users/danieldietrich/repos","events_url":"https://api.github.com/users/danieldietrich/events{/privacy}","received_events_url":"https://api.github.com/users/danieldietrich/received_events","type":"User","site_admin":false},"created_at":"2016-01-04T23:17:47Z","updated_at":"2016-01-04T23:17:47Z","body":"I ask myself why the cast works in javaslang.collection.Array#of(T) when T is a Tuple2<K, V>:\r\n\r\n```java\r\n@SuppressWarnings(\"unchecked\")\r\npublic static <T> Array<T> of(T element) {\r\n    return wrap((T[]) new Object[] { element });\r\n}\r\n```\r\n\r\nbut #tabulate it produces an exception when T is Tuple2:\r\n\r\n```java\r\n@SuppressWarnings(\"unchecked\")\r\nT[] elements = (T[]) new Object[n];\r\n```\r\n/cc @ruslansennov \r\n\r\n@simonecarriero this might be also a problem for List.tabulate if T is Tuple2. Could you verify it, please?\r\n"}}