This post is over a year old, some of this information may be out of
date.
Common SQL Clauses and Their Equivalents in Java 8 Streams
SQL | Equivalent |
---|---|
SELECT | map() |
DISTINCT | distinct() |
FROM | of(), stream() |
CROSS JOIN | flatMap() |
INNER JOIN | flatMap() with filter() |
LEFT OUTER JOIN | flatMap() with filter() and a "default" |
RIGHT OUTER JOIN | inverse LEFT OUTER JOIN |
WHERE | filter() |
ORDER BY | sorted() |
LIMIT | limit() |
OFFSET | skip() |
HAVING | filter() |
GROUP BY | collect() |
UNION ALL | concat() |
UNION | concat() and distinct() |