<p>is there a golang implementation of apache commons
<a href="https://commons.apache.org/proper/commons-collections/javadocs/api-3.2.2/org/apache/commons/collections/buffer/CircularFifoBuffer.html" rel="nofollow">CircularFifoBuffer</a></p>
<hr/>**评论:**<br/><br/>slowratatoskr: <pre><p>nvm, i made a simplified version for my usecase</p>
<p><a href="https://play.golang.org/p/m6TDGiXFbi" rel="nofollow">https://play.golang.org/p/m6TDGiXFbi</a></p></pre>ctcherry: <pre><p>Here's a method to do something similar that avoids reslicing. <a href="https://play.golang.org/p/uGmyQcUqUr" rel="nofollow">https://play.golang.org/p/uGmyQcUqUr</a></p></pre>lesmond: <pre><p>But doesn't this one always grow?</p></pre>ctcherry: <pre><p>In the Add func we reset the index to zero when needed, so it just wraps around, never allocating new space</p></pre>lesmond: <pre><p>Ah yes of course! I missed that!</p></pre>w0uld: <pre><p><a href="https://golang.org/pkg/container/ring/" rel="nofollow">https://golang.org/pkg/container/ring/</a></p></pre>huydx: <pre><p>A quick search for <code>golang ring buffer</code> give me this one
<a href="https://github.com/glycerine/rbuf" rel="nofollow">https://github.com/glycerine/rbuf</a></p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传