Skip to content

Instantly share code, notes, and snippets.

@gajoseph
Created May 30, 2018 18:35
Show Gist options
  • Save gajoseph/fb115cac5a45c8d0745a178bb20a3404 to your computer and use it in GitHub Desktop.
Save gajoseph/fb115cac5a45c8d0745a178bb20a3404 to your computer and use it in GitHub Desktop.
Java lambdaexpression ::Sharing some sample landa express to pull all ids in this cause distinct and separated by commas like ('1','2')
Sharing some sample landa express to pull all ids in this cause distinct and separated by commas like ('1','2')
In this example a tab(table) object has list of parentId_pkids which is collection of fkids() and under each fkid object there is collection of string
NOdeleet = NOdeleet + tab.parentId_pkids.fkids().stream()
.map(fkid -> fkid.Pks.stream()
.filter(ids -> !ids.deleteable)
.map(ids -> ids.Pkids.stream()
.map(Object::toString)
.collect(Collectors.joining("','"))
)
.collect(Collectors.joining("','")))
.distinct()
.collect(Collectors.joining("','", "('", "')"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment