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

12
LINES

< > BotCompany Repo | #1029070 // listFromFunction

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

Libraryless. Click here for Pure Java version (9155L/50K).

srecord noeq ListFromFunction<A>(int n, IF1<Int, A> f) extends RandomAccessAbstractList<A> {
  public int size() { ret n; }
  public A get(int i) { ret f.get(i); }
}

static <A> L<A> listFromFunction(int n, IF1<Int, A> f) {
  ret new ListFromFunction<A>(n, f);
}

static <A> L<A> lambdaMapLike listFromFunction(IF1<Int, A> f, int n) {
  ret new ListFromFunction<A>(n, f);
}

Author comment

Began life as a copy of #1029040

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1029070
Snippet name: listFromFunction
Eternal ID of this version: #1029070/5
Text MD5: 429bf407cf21d810d6bd02a0ba44ac15
Transpilation MD5: 962d31bbbf33cd24f7b89e7af78c1cc0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-30 17:47:13
Source code size: 384 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 267 / 409
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1030633 - wrapAsReversedList