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

7
LINES

< > BotCompany Repo | #1031791 // inlineSwappable - lightweight code swapping mechanism using lambdas and dynamic fields

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

Libraryless. Click here for Pure Java version (2979L/17K).

static <A> A mapMethodLike inlineSwappable(S fieldName, O host, IF0<A> defaultCalculation) {
  if (nempty(fieldName)) {
    IF0<A> replacement = cast getOpt(host, fieldName);
    if (replacement != null) ret replacement!;
  }
  ret defaultCalculation!;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031791
Snippet name: inlineSwappable - lightweight code swapping mechanism using lambdas and dynamic fields
Eternal ID of this version: #1031791/2
Text MD5: ae428c8b8f7354a1b537166c7fe95d96
Transpilation MD5: 5a132e50469edab81d4235d179781352
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-30 01:23:03
Source code size: 260 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 169 / 213
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1030949 - Transpiler output of #1031393