Performing Join Operation in Java, on a small sets of data retrieved from the database. (context: web application)

前端 未结 3 1561
小鲜肉
小鲜肉 2021-01-03 14:17

In context of a web application, Is it suitable to do some JOIN operation in Java, on the data retrieved from the database(from first query), and use that \"JOIN\"ed

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-03 14:47

    Are you asking how to do a set intersection in Java? Given your definition of the data--two datasets, entirely integers--here is my suggestion:

    Set a = new HashSet(the list of elements from the first dataset) Set b = new HashSet(the list of elements fro the second dataset)

    Set joined = a.retainAll(b); // this is how to do set intersections with java.util.Set

提交回复
热议问题