1 | static <A> A first_sync(L<A> list) {
|
2 | synchronized(list) {
|
3 | ret empty(list) ? null : list.get(0); |
4 | } |
5 | } |
6 | |
7 | static <A> A first_sync(Iterable<A> i) {
|
8 | if (i == null) null; |
9 | synchronized(i) {
|
10 | Iterator<A> it = i.iterator(); |
11 | ret it.hasNext() ? it.next() : null; |
12 | } |
13 | } |
Began life as a copy of #1000628
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: | #1011781 |
| Snippet name: | first_sync function - first() with synchronize |
| Eternal ID of this version: | #1011781/1 |
| Text MD5: | 70f5d0bf4df5544fba0e640de9be7e63 |
| Author: | stefan |
| Category: | |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-11-05 03:54:17 |
| Source code size: | 286 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 601 / 707 |
| Referenced in: | [show references] |