@@ -56,15 +56,15 @@ public final Result<List<HttpRequest<AlvadsRequestOrtb>>> makeHttpRequests(BidRe
5656 final List <BidderError > errors = new ArrayList <>();
5757 final List <HttpRequest <AlvadsRequestOrtb >> httpRequests = new ArrayList <>();
5858
59- for ( Imp imp : bidRequest .getImp ()) {
59+ bidRequest .getImp (). forEach ( imp -> {
6060 try {
6161 final AlvadsImpExt impExt = parseImpExt (imp );
6262 final HttpRequest <AlvadsRequestOrtb > request = makeHttpRequest (bidRequest , imp , impExt );
6363 httpRequests .add (request );
6464 } catch (PreBidException e ) {
6565 errors .add (BidderError .badInput (e .getMessage ()));
6666 }
67- }
67+ });
6868
6969 return httpRequests .isEmpty () ? Result .withErrors (errors ) : Result .of (httpRequests , errors );
7070 }
@@ -113,10 +113,7 @@ private static AlvaAdsImp makeImp(Imp imp) {
113113 }
114114
115115 private static Map <String , Object > sizes (Integer w , Integer h ) {
116- if (w == null || h == null ) {
117- return null ;
118- }
119- return Map .of ("w" , w , "h" , h );
116+ return (w == null || h == null ) ? null : Map .of ("w" , w , "h" , h );
120117 }
121118
122119 private static AlvaAdsSite makeSite (Site site , String publisherUniqueId ) {
@@ -158,32 +155,25 @@ private List<BidderBid> bidsFromResponse(BidResponse bidResponse, AlvadsRequestO
158155 }
159156
160157 private BidderBid makeBid (Bid bid , AlvadsRequestOrtb request , String currency ) {
161- final AlvaAdsImp imp = request .getImp ().stream ()
158+ return request .getImp ().stream ()
162159 .filter (i -> i .getId ().equals (bid .getImpid ()))
163160 .findFirst ()
161+ .map (imp -> BidderBid .of (bid , getBidType (bid , imp ), currency ))
164162 .orElse (null );
165-
166- final BidType type = getBidType (bid , imp );
167-
168- if (type == null ) {
169- return null ;
170- }
171-
172- return BidderBid .of (bid , type , currency );
173163 }
174164
175165 private BidType getBidType (Bid bid , AlvaAdsImp imp ) {
176- if (imp != null ) {
177- if (imp .getVideo () != null ) {
178- return BidType .video ;
179- }
166+ if (imp == null ) {
167+ return BidType .banner ;
168+ }
180169
181- return Optional .ofNullable (getBidExt (bid ))
182- .map (ExtBidAlvads ::getCrtype )
183- .orElse (BidType .banner );
170+ if (imp .getVideo () != null ) {
171+ return BidType .video ;
184172 }
185173
186- return null ;
174+ return Optional .ofNullable (getBidExt (bid ))
175+ .map (ExtBidAlvads ::getCrtype )
176+ .orElse (BidType .banner );
187177 }
188178
189179 private ExtBidAlvads getBidExt (Bid bid ) {
0 commit comments