1 | static <A> int countIntersection(Set<A> a, Set<A> b) { |
2 | if (a == null || b == null) ret 0; |
3 | int n = 0; |
4 | for (A x : a) if (b.contains(x)) ++n; |
5 | ret n; |
6 | } |
Began life as a copy of #1009544
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1015423 |
Snippet name: | countIntersection - iterates over first |
Eternal ID of this version: | #1015423/4 |
Text MD5: | c19641d4cbbd5d2b18b384404df66280 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-13 19:41:01 |
Source code size: | 160 bytes / 6 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 349 / 375 |
Version history: | 3 change(s) |
Referenced in: | [show references] |