title: Understanding Spliterator, Collector and Stream in Java 8
body: <p>I am having trouble understanding the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html" rel="noreferrer"><code>Stream</code></a> interface in Java 8, especially where it has to do with the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Spliterator.html" rel="noreferrer"><code>Spliterator</code></a> and <a href="https://docs.oracle.com/javase/8/docs/api/java/util/stream/Collector.html" rel="noreferrer"><code>Collector</code></a> interfaces. My problem is that I simply can't understand <code>Spliterator</code> and the <code>Collector</code> interfaces yet, and as a result, the <code>Stream</code> interface is still somewhat obscure to me.</p>
  
  <p>What exactly is a <code>Spliterator</code> and a <code>Collector</code>, and how can I use them? If I am willing to write my own <code>Spliterator</code> or <code>Collector</code> (and probably my own <code>Stream</code> in that process), what should I do and not do?</p>
  
  <p>I read some examples scattered around the web, but since everything here is still new and subject to changes, examples and tutorials are still very sparse.</p>