title: Replace part of ArrayList with other ArrayList
body: <p>Is there any simple way (for example library function) to replace fragment of one ArrayList with another ArrayList?
  What I want to do is:</p>
  
  <pre><code> ArrayList&lt;Byte&gt; fileArr = // some bytes //
   ArrayList&lt;Byte&gt; toReplace = // some bytes I want to replace in fileArray //
   ArrayList&lt;Byte&gt; window = // window with bytes from file and size of toReplace List  //
   ArrayList&lt;Byte&gt; replacing = // bytes I want to replace with //
   for(int i = 0; i &lt;= (maxElementOfFileArray - sizeOfToReplace); i++){
   window = fileArr.subList(i, i+sizeOfToReplace) 
   if(window.equals(toReplace){
        fileArr.replaceAll(i, toReplace, replacing) 
   }
  i= indexOfReplacingListFinishInFileList -1; 
  }
  </code></pre>
  
  <p>where the replaceAll function would replace elements of file ArrayList from index where subList toReplace occurs with elements of replacing list, and here's the catch: toReplace and replacing may be diffrent size Lists. Because if they would be the same size I just would do that with set function of ArraList in "for(E e : elements)" . So replace function can change size of file ArrayList it's changing.</p>