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

25
LINES

< > TinyBrain | #1013620 - Test collectionMutex (OK)

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (6469L/43K).

!7

set flag collectionMutex_debug.

p {
  autoRestart(5);
  
  L l = ll();
  assertSame("ArrayList", collectionMutex(l), l);
  
  new HashMap hmap;
  assertSame("HashMap", collectionMutex(keySet(hmap)), hmap);
  
  NavigableMap map = caseInsensitiveMap();
  assertSameVerbose("keySet/caseInsensitiveMap", collectionMutex(keySet(map)), map);
  assertSameVerbose("navigableKeys/caseInsensitiveMap", collectionMutex(navigableKeys(map)), map);
  
  map.put("bla", "");
  assertSameVerbose("prefixSubSet/navigableKeys/caseInsensitiveMap", collectionMutex(printClassName(prefixSubSet(navigableKeys(map), "bla"))), map);
  
  new WeakHashSet whs;
  assertSameVerbose(collectionMutex(whs), whs.map);
  
  print("OK!");
}

download  show line numbers  debug dex   

Travelled to 2 computer(s): cfunsshuasjs, tvejysmllsmz

No comments. add comment

Snippet ID: #1013620
Snippet name: Test collectionMutex (OK)
Eternal ID of this version: #1013620/21
Text MD5: f12d0a3b32ed7df4993943009ab58393
Transpilation MD5: 4cfed6e2c0acfedaf74a6a67e4a1f96c
Author: stefan
Category: javax / collections
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-12 11:13:50
Source code size: 737 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 43 / 313
Version history: 20 change(s)
Referenced in: [show]