snipt

Ctrl+h for KB shortcuts
#88445

Java

List to Array

String[] items = list.toArray(new String[list.size()]);
https://snipt.net/embed/0a32d4c44a721ff2049673fb62713578/
https://snipt.net/raw/0a32d4c44a721ff2049673fb62713578/
0a32d4c44a721ff2049673fb62713578
java
Java
1
2014-04-17T11:32:25
True
False
Oct 18, 2013 at 04:05 AM
/api/public/snipt/88445/
list-to-array-2
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="n">String</span><span class="o">[]</span> <span class="n">items</span> <span class="o">=</span> <span class="n">list</span><span class="o">.</span><span class="na">toArray</span><span class="o">(</span><span class="k">new</span> <span class="n">String</span><span class="o">[</span><span class="n">list</span><span class="o">.</span><span class="na">size</span><span class="o">()]);</span> </span></pre></div> </td></tr></table>
array, list, to
#54819

CSS

Zebra Stripe a list longer than 3 items

1
2
3
li:first-child:nth-last-child(n+3) ~ li:nth-child(2n-2) {
    background-color: #00f;
}
https://snipt.net/embed/98a93c8fa7e3b2946d490aa5e98db73f/
https://snipt.net/raw/98a93c8fa7e3b2946d490aa5e98db73f/
98a93c8fa7e3b2946d490aa5e98db73f
css
CSS
3
2014-04-18T15:25:12
True
False
/api/public/snipt/54819/
zebra-stripe-a-list-longer-than-3-items
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nt">li</span><span class="nd">:first-child:nth-last-child</span><span class="o">(</span><span class="nt">n</span><span class="o">+</span><span class="nt">3</span><span class="o">)</span> <span class="o">~</span> <span class="nt">li</span><span class="nd">:nth-child</span><span class="o">(</span><span class="nt">2n-2</span><span class="o">)</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="k">background-color</span><span class="o">:</span> <span class="m">#00f</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
css, list, stripe, zebra