java.util.Pair

Stephen Colebourne scolebourne at joda.org
Tue Mar 30 20:39:00 UTC 2010


While I support Kevin´s summary, having a public implementation of
Map.Entry in java.util would be very useful. (Along with making other
private classes public - unmodifiable iterator is one IIRC)
Stephen

On 30 March 2010 13:54, Kevin Bourrillion <kevinb at google.com> wrote:
> Pair is only a partial, flawed solution to a special case (n=2) of a very
> significant problem: the disproportionate complexity of creating value types
> in Java.  I support addressing the underlying problem in Java 8, and not
> littering the API with dead-end solutions like Pair.
>
>
> On Tue, Mar 30, 2010 at 1:08 AM, Weijun Wang <Weijun.Wang at sun.com> wrote:
>>
>> Hi All
>>
>> There are multiple CRs asking for a java.util.Pair class:
>>
>>   4983155
>>   6229146
>>   4947273
>>
>> I know such a simple thing can be made very complex and everyone might
>> want to add a new method into it. How about we just make it most primitive?
>> Simply an immutable and Serializable class, two final fields, one
>> constructor, two getters (?), and no static factory methods. (S)he who does
>> the real implementation has the privilege to choose between head/tail and
>> car/cdr.
>>
>> Thanks
>> Max
>>
>
>
>
> --
> Kevin Bourrillion @ Google
> internal:  http://goto/javalibraries
> external: http://guava-libraries.googlecode.com
>
>



More information about the core-libs-dev mailing list