To be able to create a custom Stream, we need to implement a custom Spliterator. If we wanted to traverse a list by using the window of the size 3, we'd be merely looking at the following groups:īut, if we wanted to traverse the same list using a window that's bigger than the collection's size, we wouldn't get a single element. Write a program for client Server chat application 10. Write a program to download a file using RS232 interface 9. Write a program to simulate the Stop and Wait protocol 8. Write a program to simulate the sliding window protocol for Selective reject 7. It gets much more intuitive when shown in an example. Write a program to simulate the sliding window protocol for Go back n 6. Simply put, the Sliding Window algorithm is a method of traversing data structures by moving a fixed-size window (sublist) over a sequence in fixed steps. Does the world need another way of implementing a sliding window operation in Java? Probably not, but you do - for your self-development. In this article, we'll take a look at how to implement a custom sliding window Stream/Spliterator in Java.