Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34058
| From | Sebastian <news@seyweiler.dyndns.org> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: own stream reduction |
| Date | 2016-04-02 23:10 +0200 |
| Organization | albasani.net |
| Message-ID | <ndpcgq$rlf$1@news.albasani.net> (permalink) |
| References | <feb2691d-116f-4519-9c4d-3e01294703aa@googlegroups.com> <ndokfn$7bb$1@dont-email.me> |
Am 02.04.2016 16:23, schrieb Eric Sosman: > On 4/2/2016 10:10 AM, Philipp Kraus wrote: >> Hello, >> >> I try to buld an own reduction stream reduction for my data structure. >> [...] >> I'm searching for a tutorial or example how I can create an own reduce >> operator of my own type. > > The Java Tutorial has a page showing how a few simple reduction > operations can be built "from the ground up:" > > http://docs.oracle.com/javase/tutorial/collections/streams/reduction.html In particular, as Stream.reduce() is a general-purpose reduction method, you don't need to define your own reduction, you just need an accumulator. The bodies of the for-loops you have shown are suitable as accumulators: They are associative binary operators on Fuzzy<Boolean>. > Also, the Javadoc for java.util.stream has some material that > looks useful. > -- Sebastian
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
own stream reduction Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2016-04-02 07:10 -0700
Re: own stream reduction Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-04-02 10:23 -0400
Re: own stream reduction Sebastian <news@seyweiler.dyndns.org> - 2016-04-02 23:10 +0200
Re: own stream reduction Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2016-04-03 08:32 -0700
csiph-web