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

10
LINES

< > BotCompany Repo | #1033257 // geometricIterator - count from a to b (exclusively) with step factor

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

Libraryless. Click here for Pure Java version (3796L/22K).

static ItIt<Double> geometricIterator(double a, double b, double factor) {
  assertTrue("factor > 1", factor > 0);
  
  ret new ItIt<Double>() {
    double i = a;
    
    public bool hasNext() { ret i < b; }
    public Double next() { var j = i; i *= factor; ret j; }
  };
}

Author comment

Began life as a copy of #1018110

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1033257
Snippet name: geometricIterator - count from a to b (exclusively) with step factor
Eternal ID of this version: #1033257/4
Text MD5: 2043982cd9591bbccc86ec135720dac7
Transpilation MD5: 98748324f5c165a1762d78902397380d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-17 22:37:39
Source code size: 284 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 125 / 180
Version history: 3 change(s)
Referenced in: [show references]