AoC2020 | Advent of Code 2020 -
kandi X-RAY | AoC2020 Summary
kandi X-RAY | AoC2020 Summary
Advent of Code 2020
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of AoC2020
AoC2020 Key Features
AoC2020 Examples and Code Snippets
Community Discussions
Trending Discussions on AoC2020
QUESTION
I was doing the AoC day six challenge when I noticed a bug in my program.
In the code below, when using List
.Clear()
and the end of the loop I had 486 copies of the last List
's values. I found a fix (hack?) but I want to know why .Clear()
isn't working on my List
. Full program can be found here.
ANSWER
Answered 2020-Dec-26 at 17:25Clear()
doesn't create a new instance, and Add()
doesn't create a copy.
So with only buffer.Clear()
, the else
block was adding a reference to the same List instance to groups
on each iteration, which was also emptied.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install AoC2020
Rust is installed and managed by the rustup tool. Rust has a 6-week rapid release process and supports a great number of platforms, so there are many builds of Rust available at any time. Please refer rust-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page