Re: ImmutablePair and compareTo()

2017-03-26 Thread Matt Sicker
Considering the limitations in syntax available for this (compare to Rust which makes things immutable by default and requires a "mut" modifier to change things), I think it'd have to be documented that this sort of pair would only work with objects that were effectively immutable. Let's see how th

Re: ImmutablePair and compareTo()

2017-03-25 Thread Gary Gregory
On Fri, Mar 3, 2017 at 8:05 AM, Matt Sicker wrote: > So would a further specialization be useful here for an immutable pair of > immutable objects? Hi Matt, But how would you guarantee that aside from using a marker interface to denote an object as being immutable? Are you talking about speci

Re: ImmutablePair and compareTo()

2017-03-03 Thread Matt Sicker
So would a further specialization be useful here for an immutable pair of immutable objects? In my own applications, I tend to embrace immutability everywhere (except for certain performance-intensive areas involving byte buffers and encoding/decoding), so being able to make assumptions about the u

Re: ImmutablePair and compareTo()

2017-03-03 Thread Jörg Schaible
Hi Matt, Matt Sicker wrote: > I took a look at this yesterday and forgot to reply. Anyways, I agree that > ImmutablePair should override compareTo() since it can rely on its own > values not changing, whereas the implementation in Pair isn't as crazy > since it's mutable. ImmutablePair is only i

Re: ImmutablePair and compareTo()

2017-03-03 Thread Matt Sicker
I took a look at this yesterday and forgot to reply. Anyways, I agree that ImmutablePair should override compareTo() since it can rely on its own values not changing, whereas the implementation in Pair isn't as crazy since it's mutable. On 2 March 2017 at 15:55, Gary Gregory wrote: > I was going

ImmutablePair and compareTo()

2017-03-02 Thread Gary Gregory
I was going to replace my custom pair class with ImmutablePair but it looks like the compareTo() methods in the superclass creates a LOT of objects on each call. Any thoughts on a custom implementation that would not create to much garbage to collect? -- E-Mail: garydgreg...@gmail.com | ggreg...@