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

11
LINES

< > BotCompany Repo | #1038791 // takeUntil - take elements from iterable until one matches the predicate

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

Libraryless. Click here for Pure Java version (10685L/58K).

1  
static <A> L<A> takeUntil(Iterable<A> l, bool includeLast, IF1<A, Bool> pred) {
2  
  new L<A> out;
3  
  fOr (A a : l)
4  
    if (pred.get(a)) {
5  
      if (includeLast)
6  
        out.add(a);
7  
      ret out;
8  
    } else
9  
      out.add(a);
10  
  ret out;
11  
}

Author comment

Began life as a copy of #1033231

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1038791
Snippet name: takeUntil - take elements from iterable until one matches the predicate
Eternal ID of this version: #1038791/3
Text MD5: 9c6e4b1151c033f743d5d3cd5eaeab92
Transpilation MD5: fef0e4230dac40b4c8af55a6ee880265
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2026-02-09 22:21:52
Source code size: 246 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 49 / 77
Version history: 2 change(s)
Referenced in: [show references]