Skip to content

Instantly share code, notes, and snippets.

@erikfried
Created February 29, 2012 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikfried/1939287 to your computer and use it in GitHub Desktop.
Save erikfried/1939287 to your computer and use it in GitHub Desktop.
Java scala collections comparison
public List<Integer> getContinuousLessThan150DaysOfferIds(List<DbLegacyOffer> list){
List<Integer> retList = new ArrayList<Integer>();
for(DbLegacyOffer offer : list) {
if(offer.isBecomesContinous() && offer.getLength() < 150)
retList.add(offer.getOfferId());
}
return retList;
}
val lessThan150 = allOffers.filter( offer => offer.isBecomeContinuous && offer.getLength < 150 ).map(_.id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment