Please can someone advise how to use Callable and Future in this scenario
I want to be able to submit mulitple bids for items from different users.
I am starting a new thread and when the winning bid value comes back I wanted to return the value. How do I spawn a new thread and return a value as soon as I have one. Will having Future.get() as the next line wait for the value to return or can it return empty value?
public AuctionBid getWinningBid(String itemCode){
Callable<AuctionBid> winningBidCallable = () -> store.getWinningBid(itemCode);
Future<AuctionBid> future = executorService.submit(winningBidCallable);
return Future.get(); // can this return empty object
}