How to convert java.util.Map to fastutil.BigList?
BigList<Employee> empList= empMap.values().stream().collect(Collectors.toList());
I see that BigList is an interface that extends java.util.Collection. You can use Collectors.toCollection to collect to this type.
You'll have to choose a specific class that implement the BigList interface. For example:
BigList<Employee> empList =
empMap.values()
.stream()
.collect(Collectors.toCollection(ReferenceBigArrayBigList::new));
Of course, if the BigList implementation you wish to create has a constructor that accepts a Collection, you can simply instantiate it yourself and pass empMap.values() to it without using Streams.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With