The observable ArrayList creation in FXCollections can be optimized by using the ArrayList constructor directly instead of calling addAll(..).
The advantage of the ArrayList constructor is that it will create an array with the correct size directly, while addAll(..) needs to grow the array first.
This will especially speed up the creation of big observable ArrayLists which may be used for e.g. (Tree)TableView or ListView.
The advantage of the ArrayList constructor is that it will create an array with the correct size directly, while addAll(..) needs to grow the array first.
This will especially speed up the creation of big observable ArrayLists which may be used for e.g. (Tree)TableView or ListView.