Skip to main content
added 119 characters in body
Source Link
Syam S
  • 8.5k
  • 1
  • 29
  • 37

TryAlternative to Pshemo's solution you could use map method.

Object[] array = new Object[size]; array = Arrays.fillstream(array, supplier).getmap(a -> new Object()).toArray(); 

Try

Arrays.fill(array, supplier.get()); 

Alternative to Pshemo's solution you could use map method.

Object[] array = new Object[size]; array = Arrays.stream(array).map(a -> new Object()).toArray(); 
Source Link
Syam S
  • 8.5k
  • 1
  • 29
  • 37

Try

Arrays.fill(array, supplier.get());