{"action":"created","comment":{"url":"https://api.github.com/repos/javaslang/javaslang/pulls/comments/59185277","id":59185277,"diff_hunk":"@@ -748,12 +771,12 @@ public boolean isEmpty() {\n \n         @Override\n         public boolean isLeaf() {\n-            return children.isEmpty();\n+            return size == 1;\n         }\n \n         @Override\n         public int size() {\n-            return 1 + children.foldLeft(0, (acc, child) -> acc + child.length());\n+            return size;","path":"javaslang/src/main/java/javaslang/collection/Tree.java","position":65,"original_position":65,"commit_id":"05fc78d30cb88adee6594cd424889c13e688c9ec","original_commit_id":"05fc78d30cb88adee6594cd424889c13e688c9ec","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},"body":"@paplorinc @ruslansennov ok, for trees with a huge branching factor it may be worth saving the time - let's experiment with it. I'm mainly interested in saving the memory. Ruslan, the 48 bytes are just for the reference, not for the whole Lazy object, aren't they? We also have a Supplier within the Lazy etc.","created_at":"2016-04-11T10:44:55Z","updated_at":"2016-04-11T10:44:55Z","html_url":"https://github.com/javaslang/javaslang/pull/1266#discussion_r59185277","pull_request_url":"https://api.github.com/repos/javaslang/javaslang/pulls/1266","_links":{"self":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/comments/59185277"},"html":{"href":"https://github.com/javaslang/javaslang/pull/1266#discussion_r59185277"},"pull_request":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1266"}}},"pull_request":{"url":"https://api.github.com/repos/javaslang/javaslang/pulls/1266","id":65902966,"html_url":"https://github.com/javaslang/javaslang/pull/1266","diff_url":"https://github.com/javaslang/javaslang/pull/1266.diff","patch_url":"https://github.com/javaslang/javaslang/pull/1266.patch","issue_url":"https://api.github.com/repos/javaslang/javaslang/issues/1266","number":1266,"state":"open","locked":false,"title":"Add Node size computation at construction time","user":{"login":"pivovarit","id":2182533,"avatar_url":"https://avatars.githubusercontent.com/u/2182533?v=3","gravatar_id":"","url":"https://api.github.com/users/pivovarit","html_url":"https://github.com/pivovarit","followers_url":"https://api.github.com/users/pivovarit/followers","following_url":"https://api.github.com/users/pivovarit/following{/other_user}","gists_url":"https://api.github.com/users/pivovarit/gists{/gist_id}","starred_url":"https://api.github.com/users/pivovarit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pivovarit/subscriptions","organizations_url":"https://api.github.com/users/pivovarit/orgs","repos_url":"https://api.github.com/users/pivovarit/repos","events_url":"https://api.github.com/users/pivovarit/events{/privacy}","received_events_url":"https://api.github.com/users/pivovarit/received_events","type":"User","site_admin":false},"body":"This closes #1248 \r\n\r\nI messed up your wildcard imports, but for me it's a good change","created_at":"2016-04-10T07:00:10Z","updated_at":"2016-04-11T10:44:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f42727d4ac4540ba70d877227203370b3a74f0f5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/javaslang/javaslang/pulls/1266/commits","review_comments_url":"https://api.github.com/repos/javaslang/javaslang/pulls/1266/comments","review_comment_url":"https://api.github.com/repos/javaslang/javaslang/pulls/comments{/number}","comments_url":"https://api.github.com/repos/javaslang/javaslang/issues/1266/comments","statuses_url":"https://api.github.com/repos/javaslang/javaslang/statuses/05fc78d30cb88adee6594cd424889c13e688c9ec","head":{"label":"pivovarit:tree_size_calculated_at_build","ref":"tree_size_calculated_at_build","sha":"05fc78d30cb88adee6594cd424889c13e688c9ec","user":{"login":"pivovarit","id":2182533,"avatar_url":"https://avatars.githubusercontent.com/u/2182533?v=3","gravatar_id":"","url":"https://api.github.com/users/pivovarit","html_url":"https://github.com/pivovarit","followers_url":"https://api.github.com/users/pivovarit/followers","following_url":"https://api.github.com/users/pivovarit/following{/other_user}","gists_url":"https://api.github.com/users/pivovarit/gists{/gist_id}","starred_url":"https://api.github.com/users/pivovarit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pivovarit/subscriptions","organizations_url":"https://api.github.com/users/pivovarit/orgs","repos_url":"https://api.github.com/users/pivovarit/repos","events_url":"https://api.github.com/users/pivovarit/events{/privacy}","received_events_url":"https://api.github.com/users/pivovarit/received_events","type":"User","site_admin":false},"repo":{"id":55394876,"name":"javaslang","full_name":"pivovarit/javaslang","owner":{"login":"pivovarit","id":2182533,"avatar_url":"https://avatars.githubusercontent.com/u/2182533?v=3","gravatar_id":"","url":"https://api.github.com/users/pivovarit","html_url":"https://github.com/pivovarit","followers_url":"https://api.github.com/users/pivovarit/followers","following_url":"https://api.github.com/users/pivovarit/following{/other_user}","gists_url":"https://api.github.com/users/pivovarit/gists{/gist_id}","starred_url":"https://api.github.com/users/pivovarit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pivovarit/subscriptions","organizations_url":"https://api.github.com/users/pivovarit/orgs","repos_url":"https://api.github.com/users/pivovarit/repos","events_url":"https://api.github.com/users/pivovarit/events{/privacy}","received_events_url":"https://api.github.com/users/pivovarit/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pivovarit/javaslang","description":"A functional library for Java 8+ that provides persistent data types and functional control structures.","fork":true,"url":"https://api.github.com/repos/pivovarit/javaslang","forks_url":"https://api.github.com/repos/pivovarit/javaslang/forks","keys_url":"https://api.github.com/repos/pivovarit/javaslang/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pivovarit/javaslang/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pivovarit/javaslang/teams","hooks_url":"https://api.github.com/repos/pivovarit/javaslang/hooks","issue_events_url":"https://api.github.com/repos/pivovarit/javaslang/issues/events{/number}","events_url":"https://api.github.com/repos/pivovarit/javaslang/events","assignees_url":"https://api.github.com/repos/pivovarit/javaslang/assignees{/user}","branches_url":"https://api.github.com/repos/pivovarit/javaslang/branches{/branch}","tags_url":"https://api.github.com/repos/pivovarit/javaslang/tags","blobs_url":"https://api.github.com/repos/pivovarit/javaslang/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pivovarit/javaslang/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pivovarit/javaslang/git/refs{/sha}","trees_url":"https://api.github.com/repos/pivovarit/javaslang/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pivovarit/javaslang/statuses/{sha}","languages_url":"https://api.github.com/repos/pivovarit/javaslang/languages","stargazers_url":"https://api.github.com/repos/pivovarit/javaslang/stargazers","contributors_url":"https://api.github.com/repos/pivovarit/javaslang/contributors","subscribers_url":"https://api.github.com/repos/pivovarit/javaslang/subscribers","subscription_url":"https://api.github.com/repos/pivovarit/javaslang/subscription","commits_url":"https://api.github.com/repos/pivovarit/javaslang/commits{/sha}","git_commits_url":"https://api.github.com/repos/pivovarit/javaslang/git/commits{/sha}","comments_url":"https://api.github.com/repos/pivovarit/javaslang/comments{/number}","issue_comment_url":"https://api.github.com/repos/pivovarit/javaslang/issues/comments{/number}","contents_url":"https://api.github.com/repos/pivovarit/javaslang/contents/{+path}","compare_url":"https://api.github.com/repos/pivovarit/javaslang/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pivovarit/javaslang/merges","archive_url":"https://api.github.com/repos/pivovarit/javaslang/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pivovarit/javaslang/downloads","issues_url":"https://api.github.com/repos/pivovarit/javaslang/issues{/number}","pulls_url":"https://api.github.com/repos/pivovarit/javaslang/pulls{/number}","milestones_url":"https://api.github.com/repos/pivovarit/javaslang/milestones{/number}","notifications_url":"https://api.github.com/repos/pivovarit/javaslang/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pivovarit/javaslang/labels{/name}","releases_url":"https://api.github.com/repos/pivovarit/javaslang/releases{/id}","deployments_url":"https://api.github.com/repos/pivovarit/javaslang/deployments","created_at":"2016-04-04T08:09:33Z","updated_at":"2016-04-04T08:09:34Z","pushed_at":"2016-04-10T07:31:37Z","git_url":"git://github.com/pivovarit/javaslang.git","ssh_url":"git@github.com:pivovarit/javaslang.git","clone_url":"https://github.com/pivovarit/javaslang.git","svn_url":"https://github.com/pivovarit/javaslang","homepage":"http://javaslang.io","size":10782,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"javaslang:master","ref":"master","sha":"66ab1b268d4575d309e49c097dabd57920e45ca2","user":{"login":"javaslang","id":5786132,"avatar_url":"https://avatars.githubusercontent.com/u/5786132?v=3","gravatar_id":"","url":"https://api.github.com/users/javaslang","html_url":"https://github.com/javaslang","followers_url":"https://api.github.com/users/javaslang/followers","following_url":"https://api.github.com/users/javaslang/following{/other_user}","gists_url":"https://api.github.com/users/javaslang/gists{/gist_id}","starred_url":"https://api.github.com/users/javaslang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javaslang/subscriptions","organizations_url":"https://api.github.com/users/javaslang/orgs","repos_url":"https://api.github.com/users/javaslang/repos","events_url":"https://api.github.com/users/javaslang/events{/privacy}","received_events_url":"https://api.github.com/users/javaslang/received_events","type":"Organization","site_admin":false},"repo":{"id":16378879,"name":"javaslang","full_name":"javaslang/javaslang","owner":{"login":"javaslang","id":5786132,"avatar_url":"https://avatars.githubusercontent.com/u/5786132?v=3","gravatar_id":"","url":"https://api.github.com/users/javaslang","html_url":"https://github.com/javaslang","followers_url":"https://api.github.com/users/javaslang/followers","following_url":"https://api.github.com/users/javaslang/following{/other_user}","gists_url":"https://api.github.com/users/javaslang/gists{/gist_id}","starred_url":"https://api.github.com/users/javaslang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javaslang/subscriptions","organizations_url":"https://api.github.com/users/javaslang/orgs","repos_url":"https://api.github.com/users/javaslang/repos","events_url":"https://api.github.com/users/javaslang/events{/privacy}","received_events_url":"https://api.github.com/users/javaslang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/javaslang/javaslang","description":"A functional library for Java 8+ that provides persistent data types and functional control structures.","fork":false,"url":"https://api.github.com/repos/javaslang/javaslang","forks_url":"https://api.github.com/repos/javaslang/javaslang/forks","keys_url":"https://api.github.com/repos/javaslang/javaslang/keys{/key_id}","collaborators_url":"https://api.github.com/repos/javaslang/javaslang/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/javaslang/javaslang/teams","hooks_url":"https://api.github.com/repos/javaslang/javaslang/hooks","issue_events_url":"https://api.github.com/repos/javaslang/javaslang/issues/events{/number}","events_url":"https://api.github.com/repos/javaslang/javaslang/events","assignees_url":"https://api.github.com/repos/javaslang/javaslang/assignees{/user}","branches_url":"https://api.github.com/repos/javaslang/javaslang/branches{/branch}","tags_url":"https://api.github.com/repos/javaslang/javaslang/tags","blobs_url":"https://api.github.com/repos/javaslang/javaslang/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/javaslang/javaslang/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/javaslang/javaslang/git/refs{/sha}","trees_url":"https://api.github.com/repos/javaslang/javaslang/git/trees{/sha}","statuses_url":"https://api.github.com/repos/javaslang/javaslang/statuses/{sha}","languages_url":"https://api.github.com/repos/javaslang/javaslang/languages","stargazers_url":"https://api.github.com/repos/javaslang/javaslang/stargazers","contributors_url":"https://api.github.com/repos/javaslang/javaslang/contributors","subscribers_url":"https://api.github.com/repos/javaslang/javaslang/subscribers","subscription_url":"https://api.github.com/repos/javaslang/javaslang/subscription","commits_url":"https://api.github.com/repos/javaslang/javaslang/commits{/sha}","git_commits_url":"https://api.github.com/repos/javaslang/javaslang/git/commits{/sha}","comments_url":"https://api.github.com/repos/javaslang/javaslang/comments{/number}","issue_comment_url":"https://api.github.com/repos/javaslang/javaslang/issues/comments{/number}","contents_url":"https://api.github.com/repos/javaslang/javaslang/contents/{+path}","compare_url":"https://api.github.com/repos/javaslang/javaslang/compare/{base}...{head}","merges_url":"https://api.github.com/repos/javaslang/javaslang/merges","archive_url":"https://api.github.com/repos/javaslang/javaslang/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/javaslang/javaslang/downloads","issues_url":"https://api.github.com/repos/javaslang/javaslang/issues{/number}","pulls_url":"https://api.github.com/repos/javaslang/javaslang/pulls{/number}","milestones_url":"https://api.github.com/repos/javaslang/javaslang/milestones{/number}","notifications_url":"https://api.github.com/repos/javaslang/javaslang/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/javaslang/javaslang/labels{/name}","releases_url":"https://api.github.com/repos/javaslang/javaslang/releases{/id}","deployments_url":"https://api.github.com/repos/javaslang/javaslang/deployments","created_at":"2014-01-30T14:07:25Z","updated_at":"2016-04-11T07:30:59Z","pushed_at":"2016-04-10T07:31:37Z","git_url":"git://github.com/javaslang/javaslang.git","ssh_url":"git@github.com:javaslang/javaslang.git","clone_url":"https://github.com/javaslang/javaslang.git","svn_url":"https://github.com/javaslang/javaslang","homepage":"http://javaslang.io","size":10850,"stargazers_count":761,"watchers_count":761,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":96,"mirror_url":null,"open_issues_count":61,"forks":96,"open_issues":61,"watchers":761,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1266"},"html":{"href":"https://github.com/javaslang/javaslang/pull/1266"},"issue":{"href":"https://api.github.com/repos/javaslang/javaslang/issues/1266"},"comments":{"href":"https://api.github.com/repos/javaslang/javaslang/issues/1266/comments"},"review_comments":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1266/comments"},"review_comment":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1266/commits"},"statuses":{"href":"https://api.github.com/repos/javaslang/javaslang/statuses/05fc78d30cb88adee6594cd424889c13e688c9ec"}}}}