Tabulators -- a catalog (original) (raw)
Raab, Donald Donald.Raab at gs.com
Fri Dec 28 08:29:02 PST 2012
- Previous message: Tabulators -- a catalog
- Next message: Tabulators -- a catalog
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
This is the route we went.
interface PartitionCollection { Collection getPositive(); Collection getNegative(); }
More specific than Pair. Less mutative, flexible and annoying than Collection[].
-----Original Message----- From: lambda-libs-spec-experts-bounces at openjdk.java.net [mailto:lambda-libs-_ _spec-experts-bounces at openjdk.java.net] On Behalf Of Brian Goetz Sent: Friday, December 28, 2012 10:50 AM To: Remi Forax Cc: lambda-libs-spec-experts at openjdk.java.net Subject: Re: Tabulators -- a catalog
Seems like overkill :( On 12/28/2012 10:46 AM, Remi Forax wrote: > On 12/28/2012 04:28 PM, Brian Goetz wrote: >> So the thing to do here is return Object[] instead of T[] / D[]. Sad, >> but not terrible. Not important enough to have the user pass in a >> factory. For want of a Pair... > > The other solution is to send a j.u.List with a specific non mutable > implementation able to store only two elements. > > Rémi > >> >> On 12/28/2012 9:39 AM, Remi Forax wrote: >>> On 12/28/2012 03:23 AM, Brian Goetz wrote: >>>> Here's a catalog of the currently implemented Tabulators. >>> >>> [...] >>> >>>> 3. Partition. Partitions a stream according to a predicate. >>>> Results always are a two-element array of something. Five forms: >>>> >>>> // Basic >>>> Tabulator<T, Collection[]> >>>> partition(Predicate predicate) >>>> >>>> // Explicit factory >>>> <T, C extends Collection> Tabulator<T, C[]> >>>> partition(Predicate predicate, >>>> Supplier rowFactory) >>>> >>>> // Partitioned mutable reduce >>>> <T, D> Tabulator<T, D[]> >>>> partition(Predicate predicate, >>>> MutableReducer<T,D> downstream) >>>> >>>> // Partitioned functional reduce >>>> Tabulator<T, T[]> >>>> partition(Predicate predicate, >>>> T zero, >>>> BinaryOperator reducer) >>>> >>>> // Partitioned functional map-reduce >>>> Tabulator<T, T[]> >>>> partition(Predicate predicate, >>>> T zero, >>>> Function<T, U> mapper, >>>> BinaryOperator reducer) >>> >>> You can't create an array of T (C, D) safely, so casting an array of >>> Object to an array of T is maybe acceptable if you control all the >>> access to that array like in collections, but here you export it. >>> >>> Rémi >>> >
- Previous message: Tabulators -- a catalog
- Next message: Tabulators -- a catalog
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the lambda-libs-spec-experts mailing list