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

43
LINES

< > BotCompany Repo | #1034618 // pcallF_typed

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

Libraryless. Click here for Pure Java version (7469L/42K).

ifclass F0
static <A> A pcallF_typed(F0<A> f) {
  pcall { ret f?!; } null;
}
endif

ifclass F1
static <A, B> B pcallF_typed(F1<A, B> f, A a) {
  pcall { ret f?.get(a); } null;
}
endif

ifclass VF1
static <A> void pcallF_typed(VF1<A> f, A a) {
  pcall {
    f?.get(a);
  }
}
endif

static <A> void pcallF_typed(IVF1<A> f, A a) {
  pcall {
    f?.get(a);
  }
}

static <A, B> void pcallF_typed(IVF2<A, B> f, A a, B b) {
  pcall {
    f?.get(a, b);
  }
}

sO pcallF_typed(Runnable r) {
  pcall { r?.run(); } null;
}

static <A> A pcallF_typed(IF0<A> f) {
  pcall { ret f?!; } null;
}

static <A, B> B pcallF_typed(IF1<A, B> f, A a) {
  pcall { ret f?.get(a); } null;
}

Author comment

Began life as a copy of #1005301

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034618
Snippet name: pcallF_typed
Eternal ID of this version: #1034618/4
Text MD5: 7d3eba405202018ab714bbc8d92e153f
Transpilation MD5: f8910b82569aad74ab7f6b34ca8ed8ba
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-26 02:04:28
Source code size: 709 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 149 / 236
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)