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

15
LINES

< > BotCompany Repo | #1012660 // assertContains

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (9622L/53K).

1  
static <A, C extends Collection<A>> C assertContains(C c, A y) {
2  
  ret assertContains(null, c, y);
3  
}
4  
5  
static <A, C extends Collection<A>> C assertContains(S msg, C c, A y) {
6  
  if (!contains(c, y))
7  
    fail((msg != null ? msg + ": " : "") + y + " not contained in " + c);
8  
  ret c;
9  
}
10  
11  
sS assertContains(S a, S b) {
12  
  if (!contains(a, b))
13  
    fail(quote(b) + " not contained in " + quote(a));
14  
  ret a;
15  
}

Author comment

Began life as a copy of #1001055

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: #1012660
Snippet name: assertContains
Eternal ID of this version: #1012660/8
Text MD5: f53a889b4fec0a9f593ee672fe2dc07e
Transpilation MD5: 03c45bfbe42a4c49f5cfb282693559d1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-11 18:36:33
Source code size: 414 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 434 / 500
Version history: 7 change(s)
Referenced in: [show references]