Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1021454 // containsAny

JavaX fragment (include)

static <A> bool containsAny(Collection<A> a, Collection<A> b) {
  if (empty(a) || empty(b)) false;
  Set<A> set = asSet(b);
  for (A x : a)
    if (contains(set, x))
      true;
  false;
}

// iterates over b
static <A, B> bool containsAny(Map<A, B> a, Collection<A> b) {
  if (empty(a)) false;
  if (b != null) for (A x : b)
    if (a.containsKey(x))
      true;
  false;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021454
Snippet name: containsAny
Eternal ID of this version: #1021454/11
Text MD5: d47e78bbf22f1059d3881fff4b82445c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-03 12:04:41
Source code size: 390 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 271 / 296
Version history: 10 change(s)
Referenced in: [show references]